From 2f045c60109e0a5811f68bcce617236e3478e402 Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Sun, 6 Apr 2014 03:32:55 +0200 Subject: Allow compiling Dolphin with KF5 This does not work properly yet, there are probably quite a few bad signal/ slot connections due to KUrl -> QUrl. However dolphin starts without crashing. Accessibility is not ported since that changed quite a lot from Qt4 -> Qt5 and I have no idea how it is supposed to be used. This is the first commit for review 117395 --- src/CMakeLists.txt | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) (limited to 'src/CMakeLists.txt') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3f584792d..41666e10d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,17 +1,17 @@ -macro_optional_find_package(Baloo) +find_package(Baloo) set_package_properties(Baloo PROPERTIES DESCRIPTION "Baloo Core libraries" URL "http://www.kde.org" TYPE OPTIONAL PURPOSE "For adding desktop-wide search and tagging support to dolphin" ) -macro_optional_find_package(BalooWidgets) +find_package(BalooWidgets) set_package_properties(BalooWidgets PROPERTIES DESCRIPTION "Baloos Widgets" URL "http://www.kde.org" TYPE OPTIONAL ) -macro_optional_find_package(KFileMetaData) +find_package(KFileMetaData) set_package_properties(KFileMetaData PROPERTIES URL "https://projects.kde.org/kfilemetadata" TYPE OPTIONAL @@ -22,6 +22,10 @@ if (Baloo_FOUND AND BalooWidgets_FOUND AND KFileMetaData_FOUND) set(HAVE_BALOO TRUE) endif() +find_package(KF5NewStuff CONFIG REQUIRED) +find_package(KF5KCMUtils CONFIG REQUIRED) +find_package(Phonon4Qt5 CONFIG REQUIRED) + configure_file(config-baloo.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-baloo.h ) macro_bool_to_01(X11_Xrender_FOUND HAVE_XRENDER) @@ -49,7 +53,7 @@ set(dolphinprivate_LIB_SRCS kitemviews/kitemlistselectionmanager.cpp kitemviews/kitemliststyleoption.cpp kitemviews/kitemlistview.cpp - kitemviews/kitemlistviewaccessible.cpp +# kitemviews/kitemlistviewaccessible.cpp kitemviews/kitemlistwidget.cpp kitemviews/kitemmodelbase.cpp kitemviews/kitemset.cpp @@ -117,9 +121,9 @@ kde4_add_library(dolphinprivate SHARED ${dolphinprivate_LIB_SRCS}) target_link_libraries( dolphinprivate - ${KDE4_KFILE_LIBS} konq - ${KDE4_KNEWSTUFF3_LIBS} + KF5::NewStuff + KF5::KDE4Support ) if(HAVE_BALOO) @@ -144,15 +148,9 @@ install(TARGETS dolphinprivate ${INSTALL_TARGETS_DEFAULT_ARGS}) set(dolphinpart_SRCS dolphinpart.cpp + dolphinpart_ext.cpp ) -# Add dolphinpart_ext.cpp conditionally, only with KDE > 4.9.1. -if (${KDE_VERSION} VERSION_GREATER "4.9.1") -set(dolphinpart_SRCS - ${dolphinpart_SRCS} - dolphinpart_ext.cpp) -endif (${KDE_VERSION} VERSION_GREATER "4.9.1") - kde4_add_plugin(dolphinpart ${dolphinpart_SRCS}) target_link_libraries(dolphinpart dolphinprivate konq ${KDE4_KPARTS_LIBS} ${KDE4_KFILE_LIBS}) @@ -235,16 +233,17 @@ kde4_add_app_icon(dolphin_SRCS "${KDE4_ICON_INSTALL_DIR}/oxygen/*/apps/system-fi kde4_add_kdeinit_executable(dolphin ${dolphin_SRCS}) +target_include_directories(kdeinit_dolphin PRIVATE ${PHONON_INCLUDES}) + target_link_libraries(kdeinit_dolphin - ${KDE4_KDEPRINT_LIBS} - ${KDE4_KFILE_LIBS} - ${KDE4_KPARTS_LIBS} - ${KDE4_KCMUTILS_LIBRARY} konq dolphinprivate - knewstuff3 - ${KDE4_SOLID_LIBS} - ${KDE4_PHONON_LIBS} + KF5::NewStuff + KF5::Parts + KF5::KCMUtils + KF5::Solid + Phonon::phonon4qt5 + KF5::KDE4Support ) if(HAVE_BALOO) -- cgit v1.3.1 From 497e2b2fefb9d37c1c07846241429921635ed02c Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Wed, 30 Apr 2014 20:35:23 +0200 Subject: Allow compiling with the frameworks branches of Baloo --- src/CMakeLists.txt | 30 ++++++++-------------- src/kitemviews/kfileitemmodelrolesupdater.cpp | 14 +++++----- src/panels/information/informationpanelcontent.cpp | 5 +++- src/views/tooltips/filemetadatatooltip.cpp | 6 +++-- 4 files changed, 26 insertions(+), 29 deletions(-) (limited to 'src/CMakeLists.txt') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 41666e10d..2eeb3ca0a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,17 +1,17 @@ -find_package(Baloo) +find_package(Baloo 4.97) set_package_properties(Baloo PROPERTIES DESCRIPTION "Baloo Core libraries" URL "http://www.kde.org" TYPE OPTIONAL PURPOSE "For adding desktop-wide search and tagging support to dolphin" ) -find_package(BalooWidgets) +find_package(BalooWidgets 4.97) set_package_properties(BalooWidgets PROPERTIES DESCRIPTION "Baloos Widgets" URL "http://www.kde.org" TYPE OPTIONAL ) -find_package(KFileMetaData) +find_package(KFileMetaData 4.97) set_package_properties(KFileMetaData PROPERTIES URL "https://projects.kde.org/kfilemetadata" TYPE OPTIONAL @@ -120,7 +120,7 @@ kde4_add_kcfg_files(dolphinprivate_LIB_SRCS kde4_add_library(dolphinprivate SHARED ${dolphinprivate_LIB_SRCS}) target_link_libraries( - dolphinprivate + dolphinprivate PUBLIC konq KF5::NewStuff KF5::KDE4Support @@ -128,10 +128,11 @@ target_link_libraries( if(HAVE_BALOO) target_link_libraries( - dolphinprivate - ${BALOO_LIBRARIES} + dolphinprivate PUBLIC + KF5::FileMetaData + ${BALOO_CORE_LIBRARY} + ${BALOO_FILE_LIBRARY} ${BALOO_WIDGETS_LIBRARY} - ${KFILEMETADATA_LIBRARY} ) endif() @@ -139,8 +140,6 @@ if(X11_Xrender_FOUND) target_link_libraries(dolphinprivate ${X11_Xrender_LIB}) endif(X11_Xrender_FOUND) -target_link_libraries(dolphinprivate ${KDE4_PLASMA_LIBS}) - set_target_properties(dolphinprivate PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION} ) install(TARGETS dolphinprivate ${INSTALL_TARGETS_DEFAULT_ARGS}) @@ -246,19 +245,12 @@ target_link_libraries(kdeinit_dolphin KF5::KDE4Support ) -if(HAVE_BALOO) - target_link_libraries(kdeinit_dolphin - ${BALOO_LIBRARIES} - ${BALOO_WIDGETS_LIBRARY} - ) -endif() - -if (KActivities_FOUND) +if (KF5Activities_FOUND) target_link_libraries( kdeinit_dolphin - ${KACTIVITIES_LIBRARY} + KF5::Activities ) -endif (KActivities_FOUND) +endif() install(TARGETS kdeinit_dolphin ${INSTALL_TARGETS_DEFAULT_ARGS}) install(TARGETS dolphin ${INSTALL_TARGETS_DEFAULT_ARGS}) diff --git a/src/kitemviews/kfileitemmodelrolesupdater.cpp b/src/kitemviews/kfileitemmodelrolesupdater.cpp index b050d5de9..acb3e0f99 100644 --- a/src/kitemviews/kfileitemmodelrolesupdater.cpp +++ b/src/kitemviews/kfileitemmodelrolesupdater.cpp @@ -282,8 +282,8 @@ void KFileItemModelRolesUpdater::setRoles(const QSet& roles) if (hasBalooRole && !m_balooFileMonitor) { m_balooFileMonitor = new Baloo::FileMonitor(this); - connect(m_balooFileMonitor, SIGNAL(fileMetaDataChanged(QString)), - this, SLOT(applyChangedBalooRoles(QString))); + connect(m_balooFileMonitor, &Baloo::FileMonitor::fileMetaDataChanged, + this, &KFileItemModelRolesUpdater::applyChangedBalooRoles); } else if (!hasBalooRole && m_balooFileMonitor) { delete m_balooFileMonitor; m_balooFileMonitor = 0; @@ -706,7 +706,7 @@ void KFileItemModelRolesUpdater::applyChangedBalooRoles(const QString& itemUrl) } Baloo::FileFetchJob* job = new Baloo::FileFetchJob(item.localPath()); - connect(job, SIGNAL(finished(KJob*)), this, SLOT(applyChangedBalooRolesJobFinished(KJob*))); + connect(job, &Baloo::FileFetchJob::finished, this, &KFileItemModelRolesUpdater::applyChangedBalooRolesJobFinished); job->setProperty("item", QVariant::fromValue(item)); job->start(); #else @@ -738,12 +738,12 @@ void KFileItemModelRolesUpdater::applyChangedBalooRolesJobFinished(KJob* kjob) data.insert(it.key(), it.value()); } - disconnect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet)), - this, SLOT(slotItemsChanged(KItemRangeList,QSet))); + disconnect(m_model, &KFileItemModel::itemsChanged, + this, &KFileItemModelRolesUpdater::slotItemsChanged); const int index = m_model->index(item); m_model->setData(index, data); - connect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet)), - this, SLOT(slotItemsChanged(KItemRangeList,QSet))); + connect(m_model, &KFileItemModel::itemsChanged, + this, &KFileItemModelRolesUpdater::slotItemsChanged); #endif } diff --git a/src/panels/information/informationpanelcontent.cpp b/src/panels/information/informationpanelcontent.cpp index 74f0ae935..fd58eb608 100644 --- a/src/panels/information/informationpanelcontent.cpp +++ b/src/panels/information/informationpanelcontent.cpp @@ -116,12 +116,15 @@ InformationPanelContent::InformationPanelContent(QWidget* parent) : #ifndef HAVE_BALOO m_metaDataWidget = new KFileMetaDataWidget(parent); + connect(m_metaDataWidget, &KFileMetaDataWidget::urlActivated, + this, &InformationPanelContent::urlActivated); #else m_metaDataWidget = new Baloo::FileMetaDataWidget(parent); + connect(m_metaDataWidget, &Baloo::FileMetaDataWidget::urlActivated, + this, &InformationPanelContent::urlActivated); #endif m_metaDataWidget->setFont(KGlobalSettings::smallestReadableFont()); m_metaDataWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum); - connect(m_metaDataWidget, &KFileMetaDataWidget::urlActivated, this, &InformationPanelContent::urlActivated); // Encapsulate the MetaDataWidget inside a container that has a dummy widget // at the bottom. This prevents that the meta data widget gets vertically stretched diff --git a/src/views/tooltips/filemetadatatooltip.cpp b/src/views/tooltips/filemetadatatooltip.cpp index bc2cbf981..d8721b767 100644 --- a/src/views/tooltips/filemetadatatooltip.cpp +++ b/src/views/tooltips/filemetadatatooltip.cpp @@ -71,13 +71,15 @@ FileMetaDataToolTip::FileMetaDataToolTip(QWidget* parent) : // Create widget for the meta data #ifndef HAVE_BALOO m_fileMetaDataWidget = new KFileMetaDataWidget(this); + connect(m_fileMetaDataWidget, &KFileMetaDataWidget::metaDataRequestFinished, + this, &FileMetaDataToolTip::metaDataRequestFinished); #else m_fileMetaDataWidget = new Baloo::FileMetaDataWidget(this); + connect(m_fileMetaDataWidget, &Baloo::FileMetaDataWidget::metaDataRequestFinished, + this, &FileMetaDataToolTip::metaDataRequestFinished); #endif m_fileMetaDataWidget->setForegroundRole(QPalette::ToolTipText); m_fileMetaDataWidget->setReadOnly(true); - connect(m_fileMetaDataWidget, &KFileMetaDataWidget::metaDataRequestFinished, - this, &FileMetaDataToolTip::metaDataRequestFinished); QVBoxLayout* textLayout = new QVBoxLayout(); textLayout->addWidget(m_name); -- cgit v1.3.1 From 7e92abb4ea2c2b269d21973bc9f2e76da5fb9114 Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Mon, 5 May 2014 23:11:12 +0200 Subject: KF5::KDE4Support -> KF5::KDELibs4Support --- src/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/CMakeLists.txt') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2eeb3ca0a..cd9017bc7 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -123,7 +123,7 @@ target_link_libraries( dolphinprivate PUBLIC konq KF5::NewStuff - KF5::KDE4Support + KF5::KDELibs4Support ) if(HAVE_BALOO) @@ -242,7 +242,7 @@ target_link_libraries(kdeinit_dolphin KF5::KCMUtils KF5::Solid Phonon::phonon4qt5 - KF5::KDE4Support + KF5::KDELibs4Support ) if (KF5Activities_FOUND) -- cgit v1.3.1 From e41c969063c14a89e40453ee6e92f70ae0e78780 Mon Sep 17 00:00:00 2001 From: Scarlett Clark Date: Fri, 20 Jun 2014 04:18:58 -0700 Subject: kde-baseapps frameworks dolphin with snapshot frameworks branch baloo/baloo-widgets path fixes. --- src/CMakeLists.txt | 4 ++-- src/kitemviews/kfileitemmodelrolesupdater.cpp | 6 +++--- src/kitemviews/private/kbaloorolesprovider.cpp | 2 +- src/panels/places/placesitemmodel.cpp | 4 ++-- src/search/dolphinfacetswidget.h | 2 +- src/search/dolphinsearchbox.cpp | 6 +++--- src/settings/additionalinfodialog.cpp | 2 +- src/views/dolphinview.cpp | 2 +- src/views/dolphinviewactionhandler.cpp | 2 +- 9 files changed, 15 insertions(+), 15 deletions(-) (limited to 'src/CMakeLists.txt') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 767cf7fe3..ce629fb9f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,4 +1,4 @@ -find_package(Baloo 4.97) +find_package(KF5Baloo 4.97) set_package_properties(Baloo PROPERTIES DESCRIPTION "Baloo Core libraries" URL "http://www.kde.org" TYPE OPTIONAL @@ -18,7 +18,7 @@ set_package_properties(KFileMetaData PROPERTIES PURPOSE "For accessing file metadata labels" ) -if (Baloo_FOUND AND BalooWidgets_FOUND AND KFileMetaData_FOUND) +if (KF5Baloo_FOUND AND BalooWidgets_FOUND AND KFileMetaData_FOUND) set(HAVE_BALOO TRUE) endif() diff --git a/src/kitemviews/kfileitemmodelrolesupdater.cpp b/src/kitemviews/kfileitemmodelrolesupdater.cpp index acb3e0f99..b62ff7859 100644 --- a/src/kitemviews/kfileitemmodelrolesupdater.cpp +++ b/src/kitemviews/kfileitemmodelrolesupdater.cpp @@ -44,9 +44,9 @@ #ifdef HAVE_BALOO #include "private/kbaloorolesprovider.h" - #include - #include - #include + #include + #include + #include #endif // #define KFILEITEMMODELROLESUPDATER_DEBUG diff --git a/src/kitemviews/private/kbaloorolesprovider.cpp b/src/kitemviews/private/kbaloorolesprovider.cpp index c0ae0c544..ea67dfbad 100644 --- a/src/kitemviews/private/kbaloorolesprovider.cpp +++ b/src/kitemviews/private/kbaloorolesprovider.cpp @@ -24,7 +24,7 @@ #include #include -#include +#include #include #include diff --git a/src/panels/places/placesitemmodel.cpp b/src/panels/places/placesitemmodel.cpp index 6ba91c5ba..d4dce607a 100644 --- a/src/panels/places/placesitemmodel.cpp +++ b/src/panels/places/placesitemmodel.cpp @@ -53,8 +53,8 @@ #include #ifdef HAVE_BALOO - #include - #include + #include + #include #endif namespace { diff --git a/src/search/dolphinfacetswidget.h b/src/search/dolphinfacetswidget.h index 757dcd482..16d497918 100644 --- a/src/search/dolphinfacetswidget.h +++ b/src/search/dolphinfacetswidget.h @@ -24,7 +24,7 @@ #include #ifdef HAVE_BALOO - #include + #include #endif class QButtonGroup; diff --git a/src/search/dolphinsearchbox.cpp b/src/search/dolphinsearchbox.cpp index df96f7434..1f946f513 100644 --- a/src/search/dolphinsearchbox.cpp +++ b/src/search/dolphinsearchbox.cpp @@ -42,9 +42,9 @@ #include #ifdef HAVE_BALOO - #include - #include - #include + #include + #include + #include #endif DolphinSearchBox::DolphinSearchBox(QWidget* parent) : diff --git a/src/settings/additionalinfodialog.cpp b/src/settings/additionalinfodialog.cpp index db9258ae8..2569acc49 100644 --- a/src/settings/additionalinfodialog.cpp +++ b/src/settings/additionalinfodialog.cpp @@ -28,7 +28,7 @@ #include #ifdef HAVE_BALOO - #include + #include #endif AdditionalInfoDialog::AdditionalInfoDialog(QWidget* parent, diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp index 0e43dcda1..df9a52db1 100644 --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -79,7 +79,7 @@ #include "zoomlevelinfo.h" #ifdef HAVE_BALOO - #include + #include #endif namespace { diff --git a/src/views/dolphinviewactionhandler.cpp b/src/views/dolphinviewactionhandler.cpp index 3955f250d..ecf5d2334 100644 --- a/src/views/dolphinviewactionhandler.cpp +++ b/src/views/dolphinviewactionhandler.cpp @@ -44,7 +44,7 @@ #include #ifdef HAVE_BALOO - #include + #include #endif DolphinViewActionHandler::DolphinViewActionHandler(KActionCollection* collection, QObject* parent) : -- cgit v1.3.1 From 96f4646b66812dd80015da7d769a499128b56074 Mon Sep 17 00:00:00 2001 From: Lukáš Tinkl Date: Fri, 20 Jun 2014 21:12:34 +0200 Subject: i18n fixes --- src/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/CMakeLists.txt') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ce629fb9f..1c5c31ea4 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,3 +1,5 @@ +add_definitions(-DTRANSLATION_DOMAIN=\"dolphin\") + find_package(KF5Baloo 4.97) set_package_properties(Baloo PROPERTIES DESCRIPTION "Baloo Core libraries" URL "http://www.kde.org" -- cgit v1.3.1 From ea1e7822e559af041c15242ed5bd8a5a5933c735 Mon Sep 17 00:00:00 2001 From: Scarlett Clark Date: Fri, 20 Jun 2014 13:08:48 -0700 Subject: Kde-baseapps frameworks - replace generic soversion. Review:118851 --- src/CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/CMakeLists.txt') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1c5c31ea4..e3ec2a9ec 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,5 +1,9 @@ add_definitions(-DTRANSLATION_DOMAIN=\"dolphin\") +ecm_setup_version(${KDE_BASEAPPS_VERSION} VARIABLE_PREFIX DOLPHINPRIVATE + SOVERSION 5 +) + find_package(KF5Baloo 4.97) set_package_properties(Baloo PROPERTIES DESCRIPTION "Baloo Core libraries" URL "http://www.kde.org" @@ -142,7 +146,7 @@ if(X11_Xrender_FOUND) target_link_libraries(dolphinprivate ${X11_Xrender_LIB}) endif(X11_Xrender_FOUND) -set_target_properties(dolphinprivate PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION} ) +set_target_properties(dolphinprivate PROPERTIES VERSION ${DOLPHINPRIVATE_VERSION_STRING} SOVERSION ${DOLPHINPRIVATE_SOVERSION} ) install(TARGETS dolphinprivate ${INSTALL_TARGETS_DEFAULT_ARGS}) ########################################## -- cgit v1.3.1 From 44178752948c61534e09600b5967cadfc833f617 Mon Sep 17 00:00:00 2001 From: Christophe Giboudeaux Date: Fri, 27 Jun 2014 10:08:24 +0200 Subject: Rename the Baloo modules. --- src/CMakeLists.txt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/CMakeLists.txt') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e3ec2a9ec..3b087aa4f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -5,26 +5,26 @@ ecm_setup_version(${KDE_BASEAPPS_VERSION} VARIABLE_PREFIX DOLPHINPRIVATE ) find_package(KF5Baloo 4.97) -set_package_properties(Baloo PROPERTIES DESCRIPTION "Baloo Core libraries" +set_package_properties(KF5Baloo PROPERTIES DESCRIPTION "Baloo Core libraries" URL "http://www.kde.org" TYPE OPTIONAL PURPOSE "For adding desktop-wide search and tagging support to dolphin" ) -find_package(BalooWidgets 4.97) -set_package_properties(BalooWidgets PROPERTIES DESCRIPTION "Baloos Widgets" +find_package(KF5BalooWidgets 4.97) +set_package_properties(KF5BalooWidgets PROPERTIES DESCRIPTION "Baloos Widgets" URL "http://www.kde.org" TYPE OPTIONAL ) -find_package(KFileMetaData 4.97) -set_package_properties(KFileMetaData PROPERTIES +find_package(KF5FileMetaData 4.97) +set_package_properties(KF5FileMetaData PROPERTIES URL "https://projects.kde.org/kfilemetadata" TYPE OPTIONAL PURPOSE "For accessing file metadata labels" ) -if (KF5Baloo_FOUND AND BalooWidgets_FOUND AND KFileMetaData_FOUND) +if (KF5Baloo_FOUND AND KF5BalooWidgets_FOUND AND KF5FileMetaData_FOUND) set(HAVE_BALOO TRUE) endif() -- cgit v1.3.1 From 3614b7fea7563300974982cca27a787749ea3f0f Mon Sep 17 00:00:00 2001 From: Christophe Giboudeaux Date: Fri, 27 Jun 2014 10:34:57 +0200 Subject: Fix build. --- src/CMakeLists.txt | 6 +++--- src/kitemviews/kfileitemmodelrolesupdater.cpp | 6 +++--- src/kitemviews/private/kbaloorolesprovider.cpp | 4 ++-- src/panels/information/filemetadataconfigurationdialog.cpp | 2 +- src/panels/information/informationpanelcontent.cpp | 2 +- src/panels/places/placesitemmodel.cpp | 4 ++-- src/search/dolphinfacetswidget.h | 2 +- src/search/dolphinsearchbox.cpp | 6 +++--- src/settings/additionalinfodialog.cpp | 2 +- src/views/dolphinview.cpp | 2 +- src/views/dolphinviewactionhandler.cpp | 2 +- src/views/tooltips/filemetadatatooltip.cpp | 2 +- 12 files changed, 20 insertions(+), 20 deletions(-) (limited to 'src/CMakeLists.txt') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3b087aa4f..8050e4cf3 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -136,9 +136,9 @@ if(HAVE_BALOO) target_link_libraries( dolphinprivate PUBLIC KF5::FileMetaData - ${BALOO_CORE_LIBRARY} - ${BALOO_FILE_LIBRARY} - ${BALOO_WIDGETS_LIBRARY} + KF5::BalooCore + KF5::BalooFiles + KF5::BalooWidgets ) endif() diff --git a/src/kitemviews/kfileitemmodelrolesupdater.cpp b/src/kitemviews/kfileitemmodelrolesupdater.cpp index b62ff7859..fb39fd225 100644 --- a/src/kitemviews/kfileitemmodelrolesupdater.cpp +++ b/src/kitemviews/kfileitemmodelrolesupdater.cpp @@ -44,9 +44,9 @@ #ifdef HAVE_BALOO #include "private/kbaloorolesprovider.h" - #include - #include - #include + #include + #include + #include #endif // #define KFILEITEMMODELROLESUPDATER_DEBUG diff --git a/src/kitemviews/private/kbaloorolesprovider.cpp b/src/kitemviews/private/kbaloorolesprovider.cpp index ea67dfbad..5096ef096 100644 --- a/src/kitemviews/private/kbaloorolesprovider.cpp +++ b/src/kitemviews/private/kbaloorolesprovider.cpp @@ -24,8 +24,8 @@ #include #include -#include -#include +#include +#include #include #include diff --git a/src/panels/information/filemetadataconfigurationdialog.cpp b/src/panels/information/filemetadataconfigurationdialog.cpp index 4ad9066c4..1ab2bd15c 100644 --- a/src/panels/information/filemetadataconfigurationdialog.cpp +++ b/src/panels/information/filemetadataconfigurationdialog.cpp @@ -22,7 +22,7 @@ #ifndef HAVE_BALOO #include #else -#include +#include #endif #include diff --git a/src/panels/information/informationpanelcontent.cpp b/src/panels/information/informationpanelcontent.cpp index 9dc59db13..1e660d5c9 100644 --- a/src/panels/information/informationpanelcontent.cpp +++ b/src/panels/information/informationpanelcontent.cpp @@ -36,7 +36,7 @@ #ifndef HAVE_BALOO #include #else -#include +#include #endif #include diff --git a/src/panels/places/placesitemmodel.cpp b/src/panels/places/placesitemmodel.cpp index d4dce607a..39dd372a8 100644 --- a/src/panels/places/placesitemmodel.cpp +++ b/src/panels/places/placesitemmodel.cpp @@ -53,8 +53,8 @@ #include #ifdef HAVE_BALOO - #include - #include + #include + #include #endif namespace { diff --git a/src/search/dolphinfacetswidget.h b/src/search/dolphinfacetswidget.h index 16d497918..46c84ce1a 100644 --- a/src/search/dolphinfacetswidget.h +++ b/src/search/dolphinfacetswidget.h @@ -24,7 +24,7 @@ #include #ifdef HAVE_BALOO - #include + #include #endif class QButtonGroup; diff --git a/src/search/dolphinsearchbox.cpp b/src/search/dolphinsearchbox.cpp index 1f946f513..78a3569a9 100644 --- a/src/search/dolphinsearchbox.cpp +++ b/src/search/dolphinsearchbox.cpp @@ -42,9 +42,9 @@ #include #ifdef HAVE_BALOO - #include - #include - #include + #include + #include + #include #endif DolphinSearchBox::DolphinSearchBox(QWidget* parent) : diff --git a/src/settings/additionalinfodialog.cpp b/src/settings/additionalinfodialog.cpp index 2569acc49..910df7b22 100644 --- a/src/settings/additionalinfodialog.cpp +++ b/src/settings/additionalinfodialog.cpp @@ -28,7 +28,7 @@ #include #ifdef HAVE_BALOO - #include + #include #endif AdditionalInfoDialog::AdditionalInfoDialog(QWidget* parent, diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp index df9a52db1..6d718f02c 100644 --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -79,7 +79,7 @@ #include "zoomlevelinfo.h" #ifdef HAVE_BALOO - #include + #include #endif namespace { diff --git a/src/views/dolphinviewactionhandler.cpp b/src/views/dolphinviewactionhandler.cpp index ecf5d2334..72f5be166 100644 --- a/src/views/dolphinviewactionhandler.cpp +++ b/src/views/dolphinviewactionhandler.cpp @@ -44,7 +44,7 @@ #include #ifdef HAVE_BALOO - #include + #include #endif DolphinViewActionHandler::DolphinViewActionHandler(KActionCollection* collection, QObject* parent) : diff --git a/src/views/tooltips/filemetadatatooltip.cpp b/src/views/tooltips/filemetadatatooltip.cpp index d8721b767..9efbe8a4f 100644 --- a/src/views/tooltips/filemetadatatooltip.cpp +++ b/src/views/tooltips/filemetadatatooltip.cpp @@ -39,7 +39,7 @@ #ifndef HAVE_BALOO #include #else -#include +#include #endif FileMetaDataToolTip::FileMetaDataToolTip(QWidget* parent) : -- cgit v1.3.1 From c8a2db7d4e79422ee3301e855ac5f6bb0a09e710 Mon Sep 17 00:00:00 2001 From: Christophe Giboudeaux Date: Sat, 28 Jun 2014 22:17:55 +0200 Subject: Create KF5::Konq --- src/CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/CMakeLists.txt') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8050e4cf3..dbce551f3 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -127,7 +127,7 @@ kde4_add_library(dolphinprivate SHARED ${dolphinprivate_LIB_SRCS}) target_link_libraries( dolphinprivate PUBLIC - konq + KF5::Konq KF5::NewStuff KF5::KDELibs4Support ) @@ -158,7 +158,7 @@ set(dolphinpart_SRCS kde4_add_plugin(dolphinpart ${dolphinpart_SRCS}) -target_link_libraries(dolphinpart dolphinprivate konq ${KDE4_KPARTS_LIBS} ${KDE4_KFILE_LIBS}) +target_link_libraries(dolphinpart dolphinprivate KF5::Konq ${KDE4_KPARTS_LIBS} ${KDE4_KFILE_LIBS}) install(TARGETS dolphinpart DESTINATION ${PLUGIN_INSTALL_DIR}) @@ -244,7 +244,7 @@ kde4_add_kdeinit_executable(dolphin ${dolphin_SRCS}) target_include_directories(kdeinit_dolphin PRIVATE ${PHONON_INCLUDES}) target_link_libraries(kdeinit_dolphin - konq + KF5::Konq dolphinprivate KF5::NewStuff KF5::Parts -- cgit v1.3.1 From 37492b227544bab6c2958c8be84a750d547890ac Mon Sep 17 00:00:00 2001 From: Christophe Giboudeaux Date: Sun, 29 Jun 2014 00:49:11 +0200 Subject: KF5ify Dolphin. --- CMakeLists.txt | 62 ++++++++++++++++++++++- src/CMakeLists.txt | 120 +++++++++++++++++++-------------------------- src/config-dolphin.h.cmake | 4 ++ src/dolphinviewcontainer.h | 6 +-- 4 files changed, 119 insertions(+), 73 deletions(-) create mode 100644 src/config-dolphin.h.cmake (limited to 'src/CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index ee27a24c8..c6cf5df81 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,2 +1,62 @@ -add_definitions(-Wno-deprecated-declarations) +cmake_minimum_required(VERSION 2.8.12) + +project(Dolphin) + +# ECM setup +find_package(ECM 0.0.14 CONFIG REQUIRED) +set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH}) + +set(DOLPHIN_VERSION "4.97.0") + +include(ECMSetupVersion) +include(GenerateExportHeader) +include(FeatureSummary) +include(KDEInstallDirs) +include(KDECMakeSettings) +include(KDEFrameworkCompilerSettings) + +ecm_setup_version(${DOLPHIN_VERSION} VARIABLE_PREFIX DOLPHINPRIVATE + SOVERSION 5 +) + +find_package(KF5 REQUIRED COMPONENTS Init KCMUtils KDELibs4Support NewStuff) +find_package(KF5 COMPONENTS Activities) + +find_package(Phonon4Qt5 CONFIG REQUIRED) + +if ("${CMAKE_SOURCE_DIR}" STREQUAL "${Dolphin_SOURCE_DIR}") + find_package(KF5Konq CONFIG REQUIRED) +else() + include_directories(${LibKonq_SOURCE_DIR}/src) +endif() + +find_package(KF5Baloo 4.97) +set_package_properties(KF5Baloo PROPERTIES DESCRIPTION "Baloo Core libraries" + URL "http://www.kde.org" + TYPE OPTIONAL + PURPOSE "For adding desktop-wide search and tagging support to dolphin" + ) + +find_package(KF5BalooWidgets 4.97) +set_package_properties(KF5BalooWidgets PROPERTIES DESCRIPTION "Baloos Widgets" + URL "http://www.kde.org" + TYPE OPTIONAL + ) + +find_package(KF5FileMetaData 4.97) +set_package_properties(KF5FileMetaData PROPERTIES + URL "https://projects.kde.org/kfilemetadata" + TYPE OPTIONAL + PURPOSE "For accessing file metadata labels" + ) + +if (KF5Baloo_FOUND AND KF5BalooWidgets_FOUND AND KF5FileMetaData_FOUND) + set(HAVE_BALOO TRUE) +endif() + add_subdirectory(src) + +# TODO Remove the if/endif lines if Dolphin is split. +if ("${CMAKE_SOURCE_DIR}" STREQUAL "${Dolphin_SOURCE_DIR}") + feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) +endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index dbce551f3..b46182cd4 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,49 +1,20 @@ -add_definitions(-DTRANSLATION_DOMAIN=\"dolphin\") - -ecm_setup_version(${KDE_BASEAPPS_VERSION} VARIABLE_PREFIX DOLPHINPRIVATE - SOVERSION 5 -) - -find_package(KF5Baloo 4.97) -set_package_properties(KF5Baloo PROPERTIES DESCRIPTION "Baloo Core libraries" - URL "http://www.kde.org" - TYPE OPTIONAL - PURPOSE "For adding desktop-wide search and tagging support to dolphin" - ) - -find_package(KF5BalooWidgets 4.97) -set_package_properties(KF5BalooWidgets PROPERTIES DESCRIPTION "Baloos Widgets" - URL "http://www.kde.org" - TYPE OPTIONAL - ) - -find_package(KF5FileMetaData 4.97) -set_package_properties(KF5FileMetaData PROPERTIES - URL "https://projects.kde.org/kfilemetadata" - TYPE OPTIONAL - PURPOSE "For accessing file metadata labels" - ) - -if (KF5Baloo_FOUND AND KF5BalooWidgets_FOUND AND KF5FileMetaData_FOUND) - set(HAVE_BALOO TRUE) -endif() - -find_package(KF5NewStuff CONFIG REQUIRED) -find_package(KF5KCMUtils CONFIG REQUIRED) -find_package(Phonon4Qt5 CONFIG REQUIRED) -configure_file(config-baloo.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-baloo.h ) +configure_file(config-baloo.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-baloo.h) -macro_bool_to_01(X11_Xrender_FOUND HAVE_XRENDER) -configure_file(config-X11.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-X11.h ) +configure_file(config-dolphin.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-dolphin.h) -include_directories( ${KACTIVITIES_INCLUDE_DIRS} ${CMAKE_CURRENT_BINARY_DIR} ) +add_definitions(-DTRANSLATION_DOMAIN=\"dolphin\") +add_definitions(-Wno-deprecated-declarations) +remove_definitions(-DQT_NO_CAST_FROM_BYTEARRAY -DQT_NO_URL_CAST_FROM_STRING) -if(HAVE_BALOO) - include_directories(${BALOO_INCLUDE_DIR} ${BALOO_WIDGETS_INCLUDE_DIR} ${KFILEMETADATA_INCLUDE_DIR}) +if(X11_Xrender_FOUND) + set(HAVE_XRENDER TRUE) endif() -add_subdirectory(tests) +configure_file(config-X11.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-X11.h) + +# TODO Reenable +#add_subdirectory(tests) ########### next target ############### @@ -114,7 +85,7 @@ if(HAVE_BALOO) ) endif() -kde4_add_kcfg_files(dolphinprivate_LIB_SRCS +kconfig_add_kcfg_files(dolphinprivate_LIB_SRCS settings/dolphin_compactmodesettings.kcfgc settings/dolphin_directoryviewpropertysettings.kcfgc settings/dolphin_detailsmodesettings.kcfgc @@ -123,13 +94,13 @@ kde4_add_kcfg_files(dolphinprivate_LIB_SRCS settings/dolphin_versioncontrolsettings.kcfgc ) -kde4_add_library(dolphinprivate SHARED ${dolphinprivate_LIB_SRCS}) +add_library(dolphinprivate ${dolphinprivate_LIB_SRCS}) target_link_libraries( dolphinprivate PUBLIC + KF5::KDELibs4Support KF5::Konq KF5::NewStuff - KF5::KDELibs4Support ) if(HAVE_BALOO) @@ -146,8 +117,12 @@ if(X11_Xrender_FOUND) target_link_libraries(dolphinprivate ${X11_Xrender_LIB}) endif(X11_Xrender_FOUND) -set_target_properties(dolphinprivate PROPERTIES VERSION ${DOLPHINPRIVATE_VERSION_STRING} SOVERSION ${DOLPHINPRIVATE_SOVERSION} ) -install(TARGETS dolphinprivate ${INSTALL_TARGETS_DEFAULT_ARGS}) +set_target_properties(dolphinprivate PROPERTIES + VERSION ${DOLPHINPRIVATE_VERSION_STRING} + SOVERSION ${DOLPHINPRIVATE_SOVERSION} +) + +install(TARGETS dolphinprivate ${KF5_INSTALL_TARGETS_DEFAULT_ARGS}) ########################################## @@ -156,14 +131,18 @@ set(dolphinpart_SRCS dolphinpart_ext.cpp ) -kde4_add_plugin(dolphinpart ${dolphinpart_SRCS}) +add_library(dolphinpart MODULE ${dolphinpart_SRCS}) -target_link_libraries(dolphinpart dolphinprivate KF5::Konq ${KDE4_KPARTS_LIBS} ${KDE4_KFILE_LIBS}) +target_link_libraries(dolphinpart + dolphinprivate + KF5::Konq + KF5::KDELibs4Support +) install(TARGETS dolphinpart DESTINATION ${PLUGIN_INSTALL_DIR}) install(FILES dolphinpart.rc DESTINATION ${DATA_INSTALL_DIR}/dolphinpart) -install(FILES dolphinpart.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) +install(FILES dolphinpart.desktop DESTINATION ${SERVICES_INSTALL_DIR}) install(FILES views/versioncontrol/fileviewversioncontrolplugin.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR}) ########################################## @@ -221,7 +200,7 @@ set(dolphin_SRCS views/zoomlevelinfo.cpp ) -kde4_add_kcfg_files(dolphin_SRCS +kconfig_add_kcfg_files(dolphin_SRCS panels/folders/dolphin_folderspanelsettings.kcfgc panels/information/dolphin_informationpanelsettings.kcfgc panels/places/dolphin_placespanelsettings.kcfgc @@ -235,11 +214,12 @@ kde4_add_kcfg_files(dolphin_SRCS if(NOT WIN32) set(dolphin_SRCS ${dolphin_SRCS} panels/terminal/terminalpanel.cpp) -endif(NOT WIN32) +endif() -kde4_add_app_icon(dolphin_SRCS "${KDE4_ICON_INSTALL_DIR}/oxygen/*/apps/system-file-manager.png") +# TODO Does anything replace kde4_add_app_icon ? +#kde4_add_app_icon(dolphin_SRCS "${KDE4_ICON_INSTALL_DIR}/oxygen/*/apps/system-file-manager.png") -kde4_add_kdeinit_executable(dolphin ${dolphin_SRCS}) +kf5_add_kdeinit_executable(dolphin ${dolphin_SRCS}) target_include_directories(kdeinit_dolphin PRIVATE ${PHONON_INCLUDES}) @@ -261,8 +241,8 @@ if (KF5Activities_FOUND) ) endif() -install(TARGETS kdeinit_dolphin ${INSTALL_TARGETS_DEFAULT_ARGS}) -install(TARGETS dolphin ${INSTALL_TARGETS_DEFAULT_ARGS}) +install(TARGETS kdeinit_dolphin ${KF5_INSTALL_TARGETS_DEFAULT_ARGS}) +install(TARGETS dolphin ${KF5_INSTALL_TARGETS_DEFAULT_ARGS}) ########################################## @@ -295,7 +275,7 @@ set(kcm_dolphingeneral_PART_SRCS settings/serviceitemdelegate.cpp settings/servicemodel.cpp) -kde4_add_kcfg_files(kcm_dolphinviewmodes_PART_SRCS +kconfig_add_kcfg_files(kcm_dolphinviewmodes_PART_SRCS settings/dolphin_compactmodesettings.kcfgc settings/dolphin_directoryviewpropertysettings.kcfgc settings/dolphin_detailsmodesettings.kcfgc @@ -304,25 +284,25 @@ kde4_add_kcfg_files(kcm_dolphinviewmodes_PART_SRCS settings/dolphin_versioncontrolsettings.kcfgc ) -kde4_add_kcfg_files(kcm_dolphinnavigation_PART_SRCS +kconfig_add_kcfg_files(kcm_dolphinnavigation_PART_SRCS settings/dolphin_generalsettings.kcfgc) -kde4_add_kcfg_files(kcm_dolphinservices_PART_SRCS +kconfig_add_kcfg_files(kcm_dolphinservices_PART_SRCS settings/dolphin_generalsettings.kcfgc settings/dolphin_versioncontrolsettings.kcfgc) -kde4_add_kcfg_files(kcm_dolphingeneral_PART_SRCS +kconfig_add_kcfg_files(kcm_dolphingeneral_PART_SRCS settings/dolphin_generalsettings.kcfgc) -kde4_add_plugin(kcm_dolphinviewmodes ${kcm_dolphinviewmodes_PART_SRCS}) -kde4_add_plugin(kcm_dolphinnavigation ${kcm_dolphinnavigation_PART_SRCS}) -kde4_add_plugin(kcm_dolphinservices ${kcm_dolphinservices_PART_SRCS}) -kde4_add_plugin(kcm_dolphingeneral ${kcm_dolphingeneral_PART_SRCS}) +add_library(kcm_dolphinviewmodes MODULE ${kcm_dolphinviewmodes_PART_SRCS}) +add_library(kcm_dolphinnavigation MODULE ${kcm_dolphinnavigation_PART_SRCS}) +add_library(kcm_dolphinservices MODULE ${kcm_dolphinservices_PART_SRCS}) +add_library(kcm_dolphingeneral MODULE ${kcm_dolphingeneral_PART_SRCS}) -target_link_libraries(kcm_dolphinviewmodes ${KDE4_KDEUI_LIBS} ${KDE4_KFILE_LIBS} dolphinprivate) -target_link_libraries(kcm_dolphinnavigation ${KDE4_KDEUI_LIBS} ${KDE4_KFILE_LIBS} dolphinprivate) -target_link_libraries(kcm_dolphinservices ${KDE4_KDEUI_LIBS} ${KDE4_KFILE_LIBS} ${KDE4_KIO_LIBS} ${KDE4_KNEWSTUFF3_LIBRARY} dolphinprivate) -target_link_libraries(kcm_dolphingeneral ${KDE4_KDEUI_LIBS} ${KDE4_KFILE_LIBS} ${KDE4_KIO_LIBS} dolphinprivate) +target_link_libraries(kcm_dolphinviewmodes KF5::KDELibs4Support dolphinprivate) +target_link_libraries(kcm_dolphinnavigation KF5::KDELibs4Support dolphinprivate) +target_link_libraries(kcm_dolphinservices KF5::KDELibs4Support dolphinprivate) +target_link_libraries(kcm_dolphingeneral KF5::KDELibs4Support dolphinprivate) install(TARGETS kcm_dolphinviewmodes DESTINATION ${PLUGIN_INSTALL_DIR} ) install(TARGETS kcm_dolphinnavigation DESTINATION ${PLUGIN_INSTALL_DIR} ) @@ -333,8 +313,11 @@ install(TARGETS kcm_dolphingeneral DESTINATION ${PLUGIN_INSTALL_DIR} ) set(kio_search_PART_SRCS search/filenamesearchprotocol.cpp) -kde4_add_plugin(kio_filenamesearch ${kio_search_PART_SRCS}) -target_link_libraries(kio_filenamesearch ${KDE4_KIO_LIBS}) + +add_library(kio_filenamesearch MODULE ${kio_search_PART_SRCS}) + +target_link_libraries(kio_filenamesearch KF5::KDELibs4Support) + install(TARGETS kio_filenamesearch DESTINATION ${PLUGIN_INSTALL_DIR}) ########### install files ############### @@ -357,4 +340,3 @@ install( FILES settings/kcm/kcmdolphingeneral.desktop DESTINATION ${SERVICES_INS install( FILES settings/services/servicemenu.knsrc DESTINATION ${CONFIG_INSTALL_DIR} ) install( PROGRAMS settings/services/servicemenuinstallation DESTINATION ${BIN_INSTALL_DIR} ) install( PROGRAMS settings/services/servicemenudeinstallation DESTINATION ${BIN_INSTALL_DIR} ) - diff --git a/src/config-dolphin.h.cmake b/src/config-dolphin.h.cmake new file mode 100644 index 000000000..45e7208e1 --- /dev/null +++ b/src/config-dolphin.h.cmake @@ -0,0 +1,4 @@ + +/* Define to 1 if you have the KActivities library. */ +#cmakedefine KF5Activities_FOUND 1 + diff --git a/src/dolphinviewcontainer.h b/src/dolphinviewcontainer.h index a7a9969c3..4ca76961c 100644 --- a/src/dolphinviewcontainer.h +++ b/src/dolphinviewcontainer.h @@ -31,9 +31,9 @@ #include #include -#include +#include -#ifdef KActivities_FOUND +#ifdef KF5Activities_FOUND namespace KActivities { class ResourceInstance; } @@ -345,7 +345,7 @@ private: KUrl m_dropDestination; QScopedPointer m_dropEvent; -#ifdef KActivities_FOUND +#ifdef KF5Activities_FOUND private: KActivities::ResourceInstance * m_activityResourceInstance; #endif -- cgit v1.3.1 From ae1960be454eadf2f6b2897824364cc22338a880 Mon Sep 17 00:00:00 2001 From: Christophe Giboudeaux Date: Sun, 29 Jun 2014 02:07:41 +0200 Subject: Reenable tests. --- src/CMakeLists.txt | 5 ++- src/tests/CMakeLists.txt | 90 +++++++++++++++++++++++++++++++++--------------- 2 files changed, 65 insertions(+), 30 deletions(-) (limited to 'src/CMakeLists.txt') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b46182cd4..f3a8bc025 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -13,9 +13,6 @@ endif() configure_file(config-X11.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-X11.h) -# TODO Reenable -#add_subdirectory(tests) - ########### next target ############### set(dolphinprivate_LIB_SRCS @@ -340,3 +337,5 @@ install( FILES settings/kcm/kcmdolphingeneral.desktop DESTINATION ${SERVICES_INS install( FILES settings/services/servicemenu.knsrc DESTINATION ${CONFIG_INSTALL_DIR} ) install( PROGRAMS settings/services/servicemenuinstallation DESTINATION ${BIN_INSTALL_DIR} ) install( PROGRAMS settings/services/servicemenudeinstallation DESTINATION ${BIN_INSTALL_DIR} ) + +add_subdirectory(tests) diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index 13a0abb58..8455ba368 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -1,5 +1,7 @@ set( EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR} ) -include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/.. ${CMAKE_CURRENT_BUILD_DIR}/.. ${KDE4_INCLUDES} ) + +find_package(Qt5Test CONFIG REQUIRED) +include(ECMMarkAsTest) # needed on windows to correctly use the files from dolphinprivate add_definitions(-DLIBDOLPHINPRIVATE_EXPORT=) @@ -9,15 +11,22 @@ set(kitemsettest_SRCS kitemsettest.cpp ../kitemviews/kitemset.cpp ) -kde4_add_unit_test(kitemsettest TEST ${kitemsettest_SRCS}) -target_link_libraries(kitemsettest dolphinprivate ${KDE4_KIO_LIBS} ${QT_QTTEST_LIBRARY}) + +add_executable(kitemsettest ${kitemsettest_SRCS}) +add_test(kitemsettest kitemsettest) +ecm_mark_as_test(kitemsettest) +target_link_libraries(kitemsettest dolphinprivate Qt5::Test) # KItemRangeTest set(kitemrangetest_SRCS kitemrangetest.cpp ) -kde4_add_unit_test(kitemrangetest TEST ${kitemrangetest_SRCS}) -target_link_libraries(kitemrangetest dolphinprivate ${KDE4_KIO_LIBS} ${QT_QTTEST_LIBRARY}) + +add_executable(kitemrangetest ${kitemrangetest_SRCS}) +add_test(kitemrangetest kitemrangetest) +ecm_mark_as_test(kitemrangetest) +target_link_libraries(kitemrangetest dolphinprivate Qt5::Test) + # KItemListSelectionManagerTest set(kitemlistselectionmanagertest_SRCS @@ -26,8 +35,11 @@ set(kitemlistselectionmanagertest_SRCS ../kitemviews/kitemmodelbase.cpp ../kitemviews/kitemset.cpp ) -kde4_add_unit_test(kitemlistselectionmanagertest TEST ${kitemlistselectionmanagertest_SRCS}) -target_link_libraries(kitemlistselectionmanagertest dolphinprivate ${KDE4_KIO_LIBS} ${QT_QTTEST_LIBRARY}) + +add_executable(kitemlistselectionmanagertest ${kitemlistselectionmanagertest_SRCS}) +add_test(kitemlistselectionmanagertest kitemlistselectionmanagertest) +ecm_mark_as_test(kitemlistselectionmanagertest) +target_link_libraries(kitemlistselectionmanagertest dolphinprivate Qt5::Test) # KItemListControllerTest set(kitemlistcontrollertest_SRCS @@ -45,8 +57,11 @@ set(kitemlistcontrollertest_SRCS ../kitemviews/kstandarditemlistview.cpp ../kitemviews/kstandarditemlistwidget.cpp ) -kde4_add_unit_test(kitemlistcontrollertest TEST ${kitemlistcontrollertest_SRCS}) -target_link_libraries(kitemlistcontrollertest dolphinprivate ${KDE4_KIO_LIBS} ${QT_QTTEST_LIBRARY}) + +add_executable(kitemlistcontrollertest ${kitemlistcontrollertest_SRCS}) +add_test(kitemlistcontrollertest kitemlistcontrollertest) +ecm_mark_as_test(kitemlistcontrollertest) +target_link_libraries(kitemlistcontrollertest dolphinprivate Qt5::Test) # KFileItemListViewTest set(kfileitemlistviewtest_SRCS @@ -63,8 +78,11 @@ set(kfileitemlistviewtest_SRCS ../kitemviews/kstandarditemlistview.cpp ../kitemviews/kstandarditemlistwidget.cpp ) -kde4_add_unit_test(kfileitemlistviewtest TEST ${kfileitemlistviewtest_SRCS}) -target_link_libraries(kfileitemlistviewtest dolphinprivate ${KDE4_KIO_LIBS} ${QT_QTTEST_LIBRARY}) + +add_executable(kfileitemlistviewtest ${kfileitemlistviewtest_SRCS}) +add_test(kfileitemlistviewtest kfileitemlistviewtest) +ecm_mark_as_test(kfileitemlistviewtest) +target_link_libraries(kfileitemlistviewtest dolphinprivate Qt5::Test) # KFileItemModelTest set(kfileitemmodeltest_SRCS @@ -74,8 +92,11 @@ set(kfileitemmodeltest_SRCS ../kitemviews/kitemmodelbase.cpp ../kitemviews/kitemset.cpp ) -kde4_add_unit_test(kfileitemmodeltest TEST ${kfileitemmodeltest_SRCS}) -target_link_libraries(kfileitemmodeltest dolphinprivate ${KDE4_KIO_LIBS} ${QT_QTTEST_LIBRARY}) + +add_executable(kfileitemmodeltest ${kfileitemmodeltest_SRCS}) +add_test(kfileitemmodeltest kfileitemmodeltest) +ecm_mark_as_test(kfileitemmodeltest) +target_link_libraries(kfileitemmodeltest dolphinprivate Qt5::Test) # KFileItemModelBenchmark set(kfileitemmodelbenchmark_SRCS @@ -84,30 +105,39 @@ set(kfileitemmodelbenchmark_SRCS ../kitemviews/kfileitemmodel.cpp ../kitemviews/kitemmodelbase.cpp ) -kde4_add_executable(kfileitemmodelbenchmark TEST ${kfileitemmodelbenchmark_SRCS}) -target_link_libraries(kfileitemmodelbenchmark dolphinprivate ${KDE4_KIO_LIBS} ${QT_QTTEST_LIBRARY}) + +add_executable(kfileitemmodelbenchmark ${kfileitemmodelbenchmark_SRCS}) +add_test(kfileitemmodelbenchmark kfileitemmodelbenchmark) +ecm_mark_as_test(kfileitemmodelbenchmark) +target_link_libraries(kfileitemmodelbenchmark dolphinprivate Qt5::Test) # KItemListKeyboardSearchManagerTest set(kitemlistkeyboardsearchmanagertest_SRCS kitemlistkeyboardsearchmanagertest.cpp ../kitemviews/private/kitemlistkeyboardsearchmanager.cpp ) -kde4_add_unit_test(kitemlistkeyboardsearchmanagertest TEST ${kitemlistkeyboardsearchmanagertest_SRCS}) -target_link_libraries(kitemlistkeyboardsearchmanagertest ${KDE4_KIO_LIBS} ${QT_QTTEST_LIBRARY}) + +add_executable(kitemlistkeyboardsearchmanagertest ${kitemlistkeyboardsearchmanagertest_SRCS}) +add_test(kitemlistkeyboardsearchmanagertest kitemlistkeyboardsearchmanagertest) +ecm_mark_as_test(kitemlistkeyboardsearchmanagertest) +target_link_libraries(kitemlistkeyboardsearchmanagertest dolphinprivate Qt5::Test) # DolphinSearchBox -if (Baloo_FOUND) +if (KF5Baloo_FOUND) set(dolphinsearchboxtest_SRCS dolphinsearchboxtest.cpp ../search/dolphinfacetswidget.cpp ../search/dolphinsearchbox.cpp ) - kde4_add_kcfg_files(dolphinsearchboxtest_SRCS + kconfig_add_kcfg_files(dolphinsearchboxtest_SRCS ../search/dolphin_searchsettings.kcfgc ) - kde4_add_unit_test(dolphinsearchboxtest TEST ${dolphinsearchboxtest_SRCS}) - target_link_libraries(dolphinsearchboxtest ${KDE4_KIO_LIBS} ${BALOO_FILE_LIBRARY} ${BALOO_CORE_LIBRARY} ${QT_QTTEST_LIBRARY}) -endif (Baloo_FOUND) + + add_executable(dolphinsearchboxtest ${dolphinsearchboxtest_SRCS}) + add_test(dolphinsearchboxtest dolphinsearchboxtest) + ecm_mark_as_test(dolphinsearchboxtest) + target_link_libraries(dolphinsearchboxtest dolphinprivate Qt5::Test) +endif() # KStandardItemModelTest set(kstandarditemmodeltest_SRCS @@ -116,8 +146,11 @@ set(kstandarditemmodeltest_SRCS ../kitemviews/kstandarditemmodel.cpp ../kitemviews/kitemmodelbase.cpp ) -kde4_add_unit_test(kstandarditemmodeltest TEST ${kstandarditemmodeltest_SRCS}) -target_link_libraries(kstandarditemmodeltest dolphinprivate ${KDE4_KIO_LIBS} ${QT_QTTEST_LIBRARY}) + +add_executable(kstandarditemmodeltest ${kstandarditemmodeltest_SRCS}) +add_test(kstandarditemmodeltest kstandarditemmodeltest) +ecm_mark_as_test(kstandarditemmodeltest) +target_link_libraries(kstandarditemmodeltest dolphinprivate Qt5::Test) # ViewPropertiesTest set(viewpropertiestest_SRCS @@ -125,9 +158,12 @@ set(viewpropertiestest_SRCS testdir.cpp ../views/viewproperties.cpp ) -kde4_add_kcfg_files(viewpropertiestest_SRCS +kconfig_add_kcfg_files(viewpropertiestest_SRCS ../settings/dolphin_generalsettings.kcfgc ../settings/dolphin_directoryviewpropertysettings.kcfgc ) -kde4_add_unit_test(viewpropertiestest TEST ${viewpropertiestest_SRCS}) -target_link_libraries(viewpropertiestest dolphinprivate ${KDE4_KIO_LIBS} ${QT_QTTEST_LIBRARY}) + +add_executable(viewpropertiestest ${viewpropertiestest_SRCS}) +add_test(viewpropertiestest viewpropertiestest) +ecm_mark_as_test(viewpropertiestest) +target_link_libraries(viewpropertiestest dolphinprivate Qt5::Test) -- cgit v1.3.1 From 8ec8450c36e1b4cd7cf00b26b8166f1e3b169321 Mon Sep 17 00:00:00 2001 From: Montel Laurent Date: Fri, 18 Jul 2014 09:26:12 +0200 Subject: install rc file to KXMLGUI_INSTALL_DIR --- src/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/CMakeLists.txt') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 62f8e8c4a..cc358a245 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -330,7 +330,7 @@ install( FILES settings/dolphin_directoryviewpropertysettings.kcfg settings/dolphin_detailsmodesettings.kcfg settings/dolphin_versioncontrolsettings.kcfg DESTINATION ${KCFG_INSTALL_DIR} ) -install( FILES dolphinui.rc DESTINATION ${DATA_INSTALL_DIR}/dolphin ) +install( FILES dolphinui.rc DESTINATION ${KXMLGUI_INSTALL_DIR}/dolphin ) install( FILES dolphin.appdata.xml DESTINATION ${SHARE_INSTALL_PREFIX}/appdata ) install( FILES search/filenamesearch.protocol DESTINATION ${SERVICES_INSTALL_DIR} ) install( FILES settings/kcm/kcmdolphinviewmodes.desktop DESTINATION -- cgit v1.3.1 From 316539b9f398413256670f2f9b1dc0058af80415 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Wed, 23 Jul 2014 12:08:33 +0200 Subject: Port accessibility to Qt 5 REVIEW: 119428 --- src/CMakeLists.txt | 2 +- src/kitemviews/kitemlistview.cpp | 24 +-- src/kitemviews/kitemlistviewaccessible.cpp | 258 +++++++++++------------------ src/kitemviews/kitemlistviewaccessible.h | 162 ++++++++---------- 4 files changed, 179 insertions(+), 267 deletions(-) (limited to 'src/CMakeLists.txt') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index cc358a245..f64c36d4c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -27,7 +27,7 @@ set(dolphinprivate_LIB_SRCS kitemviews/kitemlistselectionmanager.cpp kitemviews/kitemliststyleoption.cpp kitemviews/kitemlistview.cpp -# kitemviews/kitemlistviewaccessible.cpp + kitemviews/kitemlistviewaccessible.cpp kitemviews/kitemlistwidget.cpp kitemviews/kitemmodelbase.cpp kitemviews/kitemset.cpp diff --git a/src/kitemviews/kitemlistview.cpp b/src/kitemviews/kitemlistview.cpp index d35dd896e..8c93361e0 100644 --- a/src/kitemviews/kitemlistview.cpp +++ b/src/kitemviews/kitemlistview.cpp @@ -46,12 +46,7 @@ #include -#if 0 #include "kitemlistviewaccessible.h" -#else -#define QT_NO_ACCESSIBILITY 1 -#pragma message("TODO: port accessibility to Qt5") -#endif namespace { // Time in ms until reaching the autoscroll margin triggers @@ -63,7 +58,7 @@ namespace { } #ifndef QT_NO_ACCESSIBILITY -QAccessibleInterface* accessibleInterfaceFactory(const QString &key, QObject *object) +QAccessibleInterface* accessibleInterfaceFactory(const QString& key, QObject* object) { Q_UNUSED(key) @@ -941,7 +936,7 @@ void KItemListView::dragEnterEvent(QGraphicsSceneDragDropEvent* event) setAutoScroll(true); } -void KItemListView::dragMoveEvent(QGraphicsSceneDragDropEvent *event) +void KItemListView::dragMoveEvent(QGraphicsSceneDragDropEvent* event) { QGraphicsWidget::dragMoveEvent(event); @@ -951,7 +946,7 @@ void KItemListView::dragMoveEvent(QGraphicsSceneDragDropEvent *event) } } -void KItemListView::dragLeaveEvent(QGraphicsSceneDragDropEvent *event) +void KItemListView::dragLeaveEvent(QGraphicsSceneDragDropEvent* event) { QGraphicsWidget::dragLeaveEvent(event); setAutoScroll(false); @@ -1273,9 +1268,12 @@ void KItemListView::slotItemsChanged(const KItemRangeList& itemRanges, updateVisibleGroupHeaders(); doLayout(NoAnimation); } + + QAccessibleTableModelChangeEvent ev(this, QAccessibleTableModelChangeEvent::DataChanged); + ev.setFirstRow(itemRange.index); + ev.setLastRow(itemRange.index + itemRange.count); + QAccessible::updateAccessibility(&ev); } -#pragma message("TODO: port accessibility otherwise the following line asserts") - //QAccessible::updateAccessibility(this, 0, QAccessible::TableModelChanged); } void KItemListView::slotGroupsChanged() @@ -1351,8 +1349,10 @@ void KItemListView::slotCurrentChanged(int current, int previous) currentWidget->setCurrent(true); } } -#pragma message("TODO: port accessibility otherwise the following line asserts") - //QAccessible::updateAccessibility(this, current+1, QAccessible::Focus); + + QAccessibleEvent ev(this, QAccessible::Focus); + ev.setChild(current); + QAccessible::updateAccessibility(&ev); } void KItemListView::slotSelectionChanged(const KItemSet& current, const KItemSet& previous) diff --git a/src/kitemviews/kitemlistviewaccessible.cpp b/src/kitemviews/kitemlistviewaccessible.cpp index d9ddd58f8..8efa60fff 100644 --- a/src/kitemviews/kitemlistviewaccessible.cpp +++ b/src/kitemviews/kitemlistviewaccessible.cpp @@ -27,7 +27,7 @@ #include "kitemlistview.h" #include "private/kitemlistviewlayouter.h" -#include +#include #include #include @@ -40,35 +40,52 @@ KItemListView* KItemListViewAccessible::view() const } KItemListViewAccessible::KItemListViewAccessible(KItemListView* view_) : - QAccessibleObjectEx(view_) + QAccessibleObject(view_) { Q_ASSERT(view()); + m_cells.resize(childCount()); } -void KItemListViewAccessible::modelReset() +KItemListViewAccessible::~KItemListViewAccessible() { + foreach (QAccessibleInterface* child, m_cells) { + if (child) { + QAccessible::Id childId = QAccessible::uniqueId(child); + QAccessible::deleteAccessibleInterface(childId); + } + } } -QAccessible::Role KItemListViewAccessible::cellRole() const +void* KItemListViewAccessible::interface_cast(QAccessible::InterfaceType type) { - return QAccessible::Cell; + if (type == QAccessible::TableInterface) { + return static_cast(this); + } + return Q_NULLPTR; } -QAccessibleTable2CellInterface* KItemListViewAccessible::cell(int index) const +void KItemListViewAccessible::modelReset() +{ +} + +QAccessibleInterface* KItemListViewAccessible::cell(int index) const { if (index < 0 || index >= view()->model()->count()) { return 0; - } else { - return new KItemListAccessibleCell(view(), index); } -} -QVariant KItemListViewAccessible::invokeMethodEx(Method, int, const QVariantList&) -{ - return QVariant(); + if (m_cells.size() < index - 1) + m_cells.resize(childCount()); + + QAccessibleInterface* child = m_cells.at(index); + if (!child) { + child = new KItemListAccessibleCell(view(), index); + QAccessible::registerAccessibleInterface(child); + } + return child; } -QAccessibleTable2CellInterface* KItemListViewAccessible::cellAt(int row, int column) const +QAccessibleInterface* KItemListViewAccessible::cellAt(int row, int column) const { return cell(columnCount() * row + column); } @@ -127,9 +144,9 @@ QString KItemListViewAccessible::rowDescription(int) const return QString(); } -QList KItemListViewAccessible::selectedCells() const +QList KItemListViewAccessible::selectedCells() const { - QList cells; + QList cells; Q_FOREACH (int index, view()->controller()->selectionManager()->selectedItems()) { cells.append(cell(index)); } @@ -181,42 +198,31 @@ bool KItemListViewAccessible::unselectColumn(int) return true; } -QAccessible2::TableModelChange KItemListViewAccessible::modelChange() const +void KItemListViewAccessible::modelChange(QAccessibleTableModelChangeEvent* /*event*/) +{} + +QAccessible::Role KItemListViewAccessible::role() const { - QAccessible2::TableModelChange change; - change.lastRow = rowCount(); - change.lastColumn = columnCount(); - return change; + return QAccessible::Table; } -QAccessible::Role KItemListViewAccessible::role(int child) const +QAccessible::State KItemListViewAccessible::state() const { - Q_ASSERT(child >= 0); - - if (child > 0) { - return QAccessible::Cell; - } else { - return QAccessible::Table; - } + QAccessible::State s; + return s; } -QAccessible::State KItemListViewAccessible::state(int child) const +QAccessibleInterface* KItemListViewAccessible::childAt(int x, int y) const { - if (child) { - QAccessibleInterface* interface = 0; - navigate(Child, child, &interface); - if (interface) { - return interface->state(0); - } - } - - return QAccessible::Normal | QAccessible::HasInvokeExtension; + const QPointF point = QPointF(x, y); + int itemIndex = view()->itemAt(view()->mapFromScene(point)); + return child(itemIndex); } -int KItemListViewAccessible::childAt(int x, int y) const +QAccessibleInterface* KItemListViewAccessible::parent() const { - const QPointF point = QPointF(x,y); - return view()->itemAt(view()->mapFromScene(point)); + // FIXME: return KItemListContainerAccessible here + return Q_NULLPTR; } int KItemListViewAccessible::childCount() const @@ -227,18 +233,16 @@ int KItemListViewAccessible::childCount() const int KItemListViewAccessible::indexOfChild(const QAccessibleInterface* interface) const { const KItemListAccessibleCell* widget = static_cast(interface); - return widget->index() + 1; + return widget->index(); } -QString KItemListViewAccessible::text(Text, int child) const +QString KItemListViewAccessible::text(QAccessible::Text) const { - Q_ASSERT(child == 0); return QString(); } -QRect KItemListViewAccessible::rect(int child) const +QRect KItemListViewAccessible::rect() const { - Q_UNUSED(child) if (!view()->isVisible()) { return QRect(); } @@ -253,50 +257,14 @@ QRect KItemListViewAccessible::rect(int child) const } } -int KItemListViewAccessible::navigate(RelationFlag relation, int index, QAccessibleInterface** interface) const +QAccessibleInterface* KItemListViewAccessible::child(int index) const { - *interface = 0; - - switch (relation) { - case QAccessible::Child: - Q_ASSERT(index > 0); - *interface = cell(index - 1); - if (*interface) { - return 0; - } - break; - - default: - break; + if (index >= 0 && index < childCount()) { + return cell(index); } - - return -1; + return Q_NULLPTR; } -QAccessible::Relation KItemListViewAccessible::relationTo(int, const QAccessibleInterface*, int) const -{ - return QAccessible::Unrelated; -} - -#ifndef QT_NO_ACTION - -int KItemListViewAccessible::userActionCount(int) const -{ - return 0; -} - -QString KItemListViewAccessible::actionText(int, Text, int) const -{ - return QString(); -} - -bool KItemListViewAccessible::doAction(int, int, const QVariantList&) -{ - return false; -} - -#endif - // Table Cell KItemListAccessibleCell::KItemListAccessibleCell(KItemListView* view, int index) : @@ -306,6 +274,14 @@ KItemListAccessibleCell::KItemListAccessibleCell(KItemListView* view, int index) Q_ASSERT(index >= 0 && index < view->model()->count()); } +void* KItemListAccessibleCell::interface_cast(QAccessible::InterfaceType type) +{ + if (type == QAccessible::TableCellInterface) { + return static_cast(this); + } + return Q_NULLPTR; +} + int KItemListAccessibleCell::columnExtent() const { return 1; @@ -341,52 +317,39 @@ bool KItemListAccessibleCell::isSelected() const return m_view->controller()->selectionManager()->isSelected(m_index); } -void KItemListAccessibleCell::rowColumnExtents(int* row, int* column, int* rowExtents, int* columnExtents, bool* selected) const +QAccessibleInterface* KItemListAccessibleCell::table() const { - const KItemListViewLayouter* layouter = m_view->m_layouter; - *row = layouter->itemRow(m_index); - *column = layouter->itemColumn(m_index); - *rowExtents = 1; - *columnExtents = 1; - *selected = isSelected(); + return QAccessible::queryAccessibleInterface(m_view); } -QAccessibleTable2Interface* KItemListAccessibleCell::table() const +QAccessible::Role KItemListAccessibleCell::role() const { - return QAccessible::queryAccessibleInterface(m_view)->table2Interface(); -} - -QAccessible::Role KItemListAccessibleCell::role(int child) const -{ - Q_ASSERT(child == 0); return QAccessible::Cell; } -QAccessible::State KItemListAccessibleCell::state(int child) const +QAccessible::State KItemListAccessibleCell::state() const { - Q_ASSERT(child == 0); - QAccessible::State state = Normal; + QAccessible::State state; + state.selectable = true; if (isSelected()) { - state |= Selected; + state.selected = true; } + state.focusable = true; if (m_view->controller()->selectionManager()->currentItem() == m_index) { - state |= Focused; + state.focused = true; } - state |= Selectable; - state |= Focusable; - if (m_view->controller()->selectionBehavior() == KItemListController::MultiSelection) { - state |= MultiSelectable; + state.multiSelectable = true; } if (m_view->model()->isExpandable(m_index)) { if (m_view->model()->isExpanded(m_index)) { - state |= Expanded; + state.expanded = true; } else { - state |= Collapsed; + state.collapsed = true; } } @@ -398,7 +361,7 @@ bool KItemListAccessibleCell::isExpandable() const return m_view->model()->isExpandable(m_index); } -QRect KItemListAccessibleCell::rect(int) const +QRect KItemListAccessibleCell::rect() const { QRect rect = m_view->itemRect(m_index).toRect(); @@ -411,13 +374,9 @@ QRect KItemListAccessibleCell::rect(int) const return rect; } -QString KItemListAccessibleCell::text(QAccessible::Text t, int child) const +QString KItemListAccessibleCell::text(QAccessible::Text t) const { - Q_ASSERT(child == 0); - Q_UNUSED(child) - switch (t) { - case QAccessible::Value: case QAccessible::Name: { const QHash data = m_view->model()->data(m_index); return data["text"].toString(); @@ -430,9 +389,13 @@ QString KItemListAccessibleCell::text(QAccessible::Text t, int child) const return QString(); } -void KItemListAccessibleCell::setText(QAccessible::Text, int child, const QString&) +void KItemListAccessibleCell::setText(QAccessible::Text, const QString&) { - Q_ASSERT(child == 0); +} + +QAccessibleInterface* KItemListAccessibleCell::child(int) const +{ + return Q_NULLPTR; } bool KItemListAccessibleCell::isValid() const @@ -440,9 +403,9 @@ bool KItemListAccessibleCell::isValid() const return m_view && (m_index >= 0) && (m_index < m_view->model()->count()); } -int KItemListAccessibleCell::childAt(int, int) const +QAccessibleInterface* KItemListAccessibleCell::childAt(int, int) const { - return 0; + return Q_NULLPTR; } int KItemListAccessibleCell::childCount() const @@ -456,43 +419,11 @@ int KItemListAccessibleCell::indexOfChild(const QAccessibleInterface* child) con return -1; } -int KItemListAccessibleCell::navigate(RelationFlag relation, int index, QAccessibleInterface** interface) const -{ - if (relation == Ancestor && index == 1) { - *interface = new KItemListViewAccessible(m_view); - return 0; - } - - *interface = 0; - return -1; -} - -QAccessible::Relation KItemListAccessibleCell::relationTo(int child, const QAccessibleInterface* , int otherChild) const -{ - Q_ASSERT(child == 0); - Q_ASSERT(otherChild == 0); - return QAccessible::Unrelated; -} - -#ifndef QT_NO_ACTION - -int KItemListAccessibleCell::userActionCount(int) const +QAccessibleInterface* KItemListAccessibleCell::parent() const { - return 0; -} - -QString KItemListAccessibleCell::actionText(int, Text, int) const -{ - return QString(); + return QAccessible::queryAccessibleInterface(m_view); } -bool KItemListAccessibleCell::doAction(int, int, const QVariantList&) -{ - return false; -} - -#endif - int KItemListAccessibleCell::index() const { return m_index; @@ -505,7 +436,7 @@ QObject* KItemListAccessibleCell::object() const // Container Interface KItemListContainerAccessible::KItemListContainerAccessible(KItemListContainer* container) : - QAccessibleWidgetEx(container) + QAccessibleWidget(container) { } @@ -521,20 +452,17 @@ int KItemListContainerAccessible::childCount() const int KItemListContainerAccessible::indexOfChild(const QAccessibleInterface* child) const { if (child->object() == container()->controller()->view()) { - return 1; - } else { - return -1; + return 0; } + return -1; } -int KItemListContainerAccessible::navigate(QAccessible::RelationFlag relation, int index, QAccessibleInterface** target) const +QAccessibleInterface* KItemListContainerAccessible::child(int index) const { - if (relation == QAccessible::Child) { - *target = new KItemListViewAccessible(container()->controller()->view()); - return 0; - } else { - return QAccessibleWidgetEx::navigate(relation, index, target); + if (index == 0) { + return QAccessible::queryAccessibleInterface(container()->controller()->view()); } + return Q_NULLPTR; } const KItemListContainer* KItemListContainerAccessible::container() const diff --git a/src/kitemviews/kitemlistviewaccessible.h b/src/kitemviews/kitemlistviewaccessible.h index c2213cd67..674f1d1af 100644 --- a/src/kitemviews/kitemlistviewaccessible.h +++ b/src/kitemviews/kitemlistviewaccessible.h @@ -22,118 +22,104 @@ #ifndef QT_NO_ACCESSIBILITY +#include + #include #include -#include -#include #include +#include class KItemListView; class KItemListContainer; -class KItemListViewAccessible: public QAccessibleTable2Interface, public QAccessibleObjectEx +class LIBDOLPHINPRIVATE_EXPORT KItemListViewAccessible: public QAccessibleObject, public QAccessibleTableInterface { - Q_ACCESSIBLE_OBJECT - public: explicit KItemListViewAccessible(KItemListView* view); - - Role role(int child) const; - State state(int child) const; - QString text(Text t, int child) const; - QRect rect(int child) const; - - int childAt(int x, int y) const; - int childCount() const; - int indexOfChild(const QAccessibleInterface*) const; - - int navigate(RelationFlag relation, int index, QAccessibleInterface** interface) const; - Relation relationTo(int child, const QAccessibleInterface* other, int otherChild) const; - -#ifndef QT_NO_ACTION - int userActionCount(int child) const; - QString actionText(int action, Text t, int child) const; - bool doAction(int action, int child, const QVariantList& params); -#endif - QVariant invokeMethodEx(Method, int, const QVariantList&); - - // Table2 interface - virtual QAccessibleTable2CellInterface* cellAt(int row, int column) const; - virtual QAccessibleInterface* caption() const; - virtual QAccessibleInterface* summary() const; - virtual QString columnDescription(int column) const; - virtual QString rowDescription(int row) const; - virtual int columnCount() const; - virtual int rowCount() const; - virtual QAccessible2::TableModelChange modelChange() const; - virtual void rowsInserted(const QModelIndex&, int, int) {} - virtual void rowsRemoved(const QModelIndex&, int, int) {} - virtual void columnsInserted(const QModelIndex&, int, int) {} - virtual void columnsRemoved(const QModelIndex&, int, int) {} - virtual void rowsMoved(const QModelIndex&, int, int, const QModelIndex&, int) {} - virtual void columnsMoved(const QModelIndex&, int, int, const QModelIndex&, int) {} + ~KItemListViewAccessible(); + + void* interface_cast(QAccessible::InterfaceType type) Q_DECL_OVERRIDE; + + QAccessible::Role role() const Q_DECL_OVERRIDE; + QAccessible::State state() const Q_DECL_OVERRIDE; + QString text(QAccessible::Text t) const Q_DECL_OVERRIDE; + QRect rect() const Q_DECL_OVERRIDE; + + QAccessibleInterface* child(int index) const Q_DECL_OVERRIDE; + int childCount() const Q_DECL_OVERRIDE; + int indexOfChild(const QAccessibleInterface*) const Q_DECL_OVERRIDE; + QAccessibleInterface* childAt(int x, int y) const Q_DECL_OVERRIDE; + QAccessibleInterface* parent() const Q_DECL_OVERRIDE; + + // Table interface + virtual QAccessibleInterface* cellAt(int row, int column) const Q_DECL_OVERRIDE; + virtual QAccessibleInterface* caption() const Q_DECL_OVERRIDE; + virtual QAccessibleInterface* summary() const Q_DECL_OVERRIDE; + virtual QString columnDescription(int column) const Q_DECL_OVERRIDE; + virtual QString rowDescription(int row) const Q_DECL_OVERRIDE; + virtual int columnCount() const Q_DECL_OVERRIDE; + virtual int rowCount() const Q_DECL_OVERRIDE; // Selection - virtual int selectedCellCount() const; - virtual int selectedColumnCount() const; - virtual int selectedRowCount() const; - virtual QList selectedCells() const; - virtual QList selectedColumns() const; - virtual QList selectedRows() const; - virtual bool isColumnSelected(int column) const; - virtual bool isRowSelected(int row) const; - virtual bool selectRow(int row); - virtual bool selectColumn(int column); - virtual bool unselectRow(int row); - virtual bool unselectColumn(int column); + virtual int selectedCellCount() const Q_DECL_OVERRIDE; + virtual int selectedColumnCount() const Q_DECL_OVERRIDE; + virtual int selectedRowCount() const Q_DECL_OVERRIDE; + virtual QList selectedCells() const Q_DECL_OVERRIDE; + virtual QList selectedColumns() const Q_DECL_OVERRIDE; + virtual QList selectedRows() const Q_DECL_OVERRIDE; + virtual bool isColumnSelected(int column) const Q_DECL_OVERRIDE; + virtual bool isRowSelected(int row) const Q_DECL_OVERRIDE; + virtual bool selectRow(int row) Q_DECL_OVERRIDE; + virtual bool selectColumn(int column) Q_DECL_OVERRIDE; + virtual bool unselectRow(int row) Q_DECL_OVERRIDE; + virtual bool unselectColumn(int column) Q_DECL_OVERRIDE; + virtual void modelChange(QAccessibleTableModelChangeEvent*) Q_DECL_OVERRIDE; KItemListView* view() const; protected: virtual void modelReset(); /** - * Create an QAccessibleTable2CellInterface representing the table + * Create an QAccessibleTableCellInterface representing the table * cell at the @index. Index is 0-based. */ - inline QAccessibleTable2CellInterface* cell(int index) const; - inline QAccessible::Role cellRole() const; + inline QAccessibleInterface* cell(int index) const; + +private: + mutable QVector m_cells; }; -class KItemListAccessibleCell: public QAccessibleTable2CellInterface +class LIBDOLPHINPRIVATE_EXPORT KItemListAccessibleCell: public QAccessibleInterface, public QAccessibleTableCellInterface { public: KItemListAccessibleCell(KItemListView* view, int m_index); - QObject* object() const; - Role role(int) const; - State state(int) const; - QRect rect(int) const; - bool isValid() const; - int childAt(int, int) const; - int childCount() const; - int indexOfChild(const QAccessibleInterface*) const; - QString text(Text t, int child) const; - void setText(Text t, int child, const QString& text); - int navigate(RelationFlag relation, int m_index, QAccessibleInterface** interface) const; - Relation relationTo(int child, const QAccessibleInterface* other, int otherChild) const; + void* interface_cast(QAccessible::InterfaceType type) Q_DECL_OVERRIDE; + QObject* object() const Q_DECL_OVERRIDE; + bool isValid() const Q_DECL_OVERRIDE; + QAccessible::Role role() const Q_DECL_OVERRIDE; + QAccessible::State state() const Q_DECL_OVERRIDE; + QRect rect() const Q_DECL_OVERRIDE; + QString text(QAccessible::Text t) const Q_DECL_OVERRIDE; + void setText(QAccessible::Text t, const QString& text) Q_DECL_OVERRIDE; + + QAccessibleInterface* child(int index) const Q_DECL_OVERRIDE; + int childCount() const Q_DECL_OVERRIDE; + QAccessibleInterface* childAt(int x, int y) const Q_DECL_OVERRIDE; + int indexOfChild(const QAccessibleInterface*) const Q_DECL_OVERRIDE; + + QAccessibleInterface* parent() const Q_DECL_OVERRIDE; bool isExpandable() const; -#ifndef QT_NO_ACTION - int userActionCount(int child) const; - QString actionText(int action, Text t, int child) const; - bool doAction(int action, int child, const QVariantList& params); -#endif - // Cell Interface - virtual int columnExtent() const; - virtual QList columnHeaderCells() const; - virtual int columnIndex() const; - virtual int rowExtent() const; - virtual QList rowHeaderCells() const; - virtual int rowIndex() const; - virtual bool isSelected() const; - virtual void rowColumnExtents(int* row, int* column, int* rowExtents, int* columnExtents, bool* selected) const; - virtual QAccessibleTable2Interface* table() const; + virtual int columnExtent() const Q_DECL_OVERRIDE; + virtual QList columnHeaderCells() const Q_DECL_OVERRIDE; + virtual int columnIndex() const Q_DECL_OVERRIDE; + virtual int rowExtent() const Q_DECL_OVERRIDE; + virtual QList rowHeaderCells() const Q_DECL_OVERRIDE; + virtual int rowIndex() const Q_DECL_OVERRIDE; + virtual bool isSelected() const Q_DECL_OVERRIDE; + virtual QAccessibleInterface* table() const Q_DECL_OVERRIDE; inline int index() const; @@ -142,17 +128,15 @@ private: int m_index; }; -class KItemListContainerAccessible : public QAccessibleWidgetEx +class LIBDOLPHINPRIVATE_EXPORT KItemListContainerAccessible : public QAccessibleWidget { - Q_ACCESSIBLE_OBJECT - public: explicit KItemListContainerAccessible(KItemListContainer* container); virtual ~KItemListContainerAccessible(); - int childCount() const; - int indexOfChild(const QAccessibleInterface* child) const; - int navigate(RelationFlag relation, int entry, QAccessibleInterface** target) const; + QAccessibleInterface* child(int index) const Q_DECL_OVERRIDE; + int childCount() const Q_DECL_OVERRIDE; + int indexOfChild(const QAccessibleInterface* child) const Q_DECL_OVERRIDE; private: const KItemListContainer* container() const; -- cgit v1.3.1 From 3d89079aa403f82169575ac68759ddb806596e66 Mon Sep 17 00:00:00 2001 From: David Faure Date: Sun, 24 Aug 2014 15:40:50 +0200 Subject: use non-deprecated cmake var name --- src/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/CMakeLists.txt') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 5c9c8c95e..fec365abf 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -331,7 +331,7 @@ install( FILES settings/dolphin_directoryviewpropertysettings.kcfg settings/dolphin_detailsmodesettings.kcfg settings/dolphin_versioncontrolsettings.kcfg DESTINATION ${KCFG_INSTALL_DIR} ) -install( FILES dolphinui.rc DESTINATION ${KXMLGUI_INSTALL_DIR}/dolphin ) +install( FILES dolphinui.rc DESTINATION ${CMAKE_INSTALL_KXMLGUI5DIR}/dolphin ) install( FILES dolphin.appdata.xml DESTINATION ${SHARE_INSTALL_PREFIX}/appdata ) install( FILES search/filenamesearch.protocol DESTINATION ${SERVICES_INSTALL_DIR} ) install( FILES settings/kcm/kcmdolphinviewmodes.desktop DESTINATION -- cgit v1.3.1 From e3578ee3b770a1b8f359ed1a3cc6e3ac7f6c700e Mon Sep 17 00:00:00 2001 From: Denis Steckelmacher Date: Wed, 10 Sep 2014 10:16:11 +0200 Subject: Use the Baloo Query Builder widget to add syntax-highlighting in Dolphin search REVIEW: 112589 --- src/CMakeLists.txt | 1 + src/search/dolphinsearchbox.cpp | 53 ++++++++++++++++++++++++++++++----------- src/search/dolphinsearchbox.h | 17 +++++++++++-- 3 files changed, 55 insertions(+), 16 deletions(-) (limited to 'src/CMakeLists.txt') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index fec365abf..3ad68c7f2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -106,6 +106,7 @@ if(HAVE_BALOO) KF5::FileMetaData KF5::BalooCore KF5::BalooFiles + KF5::BalooNaturalQueryParser KF5::BalooWidgets ) endif() diff --git a/src/search/dolphinsearchbox.cpp b/src/search/dolphinsearchbox.cpp index ae93030ac..27a251b7d 100644 --- a/src/search/dolphinsearchbox.cpp +++ b/src/search/dolphinsearchbox.cpp @@ -40,8 +40,9 @@ #include #include -#include #ifdef HAVE_BALOO + #include + #include #include #include #include @@ -252,8 +253,10 @@ void DolphinSearchBox::slotConfigurationChanged() } } -void DolphinSearchBox::slotSearchTextChanged(const QString& text) +void DolphinSearchBox::slotSearchTextChanged() { + const QString text = m_searchInput->text(); + if (text.isEmpty()) { m_startSearchTimer->stop(); } else { @@ -262,10 +265,17 @@ void DolphinSearchBox::slotSearchTextChanged(const QString& text) emit searchTextChanged(text); } -void DolphinSearchBox::slotReturnPressed(const QString& text) +void DolphinSearchBox::slotReturnPressed() { emitSearchRequest(); - emit returnPressed(text); + emit returnPressed(m_searchInput->text()); +} + +void DolphinSearchBox::updateSearchInputParsing() +{ +#ifdef HAVE_NEPOMUK + m_searchInput->setParsingEnabled(m_contentButton->isChecked()); +#endif } void DolphinSearchBox::slotFacetsButtonToggled() @@ -306,6 +316,7 @@ void DolphinSearchBox::loadSettings() } m_facetsWidget->setVisible(SearchSettings::showFacetsWidget()); + updateSearchInputParsing(); } void DolphinSearchBox::saveSettings() @@ -329,15 +340,24 @@ void DolphinSearchBox::init() m_searchLabel = new QLabel(this); // Create search box +#ifdef HAVE_BALOO + m_queryParser.reset(new Baloo::NaturalFileQueryParser); + m_searchInput = new Baloo::QueryBuilder(m_queryParser.data(), this); + connect(m_searchInput, &Baloo::QueryBuilder::editingFinished, + this, &DolphinSearchBox::slotReturnPressed); + connect(m_searchInput, &Baloo::QueryBuilder::textChanged, + this, &DolphinSearchBox::slotSearchTextChanged); +#else m_searchInput = new KLineEdit(this); m_searchInput->installEventFilter(this); m_searchInput->setClearButtonShown(true); m_searchInput->setFont(KGlobalSettings::generalFont()); - setFocusProxy(m_searchInput); - connect(m_searchInput, static_cast(&KLineEdit::returnPressed), + connect(m_searchInput, &KLineEdit::returnPressed, this, &DolphinSearchBox::slotReturnPressed); connect(m_searchInput, &KLineEdit::textChanged, this, &DolphinSearchBox::slotSearchTextChanged); +#endif + setFocusProxy(m_searchInput); // Apply layout for the search input QHBoxLayout* searchInputLayout = new QHBoxLayout(); @@ -358,6 +378,8 @@ void DolphinSearchBox::init() QButtonGroup* searchWhatGroup = new QButtonGroup(this); searchWhatGroup->addButton(m_fileNameButton); searchWhatGroup->addButton(m_contentButton); + connect(searchWhatGroup, static_cast(&QButtonGroup::buttonClicked), + this, &DolphinSearchBox::updateSearchInputParsing); m_separator = new KSeparator(Qt::Vertical, this); @@ -434,28 +456,31 @@ KUrl DolphinSearchBox::balooUrlForSearching() const const QString text = m_searchInput->text(); Baloo::Query query; + + if (m_contentButton->isChecked()) { + query = m_queryParser->parse(text, Baloo::NaturalQueryParser::DetectFilenamePattern); + } else { + query.setTerm(Baloo::Term(QLatin1String("filename"), text)); + } + + // Configure the query so that it returns files and takes the rating into account query.addType("File"); query.addType(m_facetsWidget->facetType()); Baloo::Term term(Baloo::Term::And); - Baloo::Term ratingTerm = m_facetsWidget->ratingTerm(); + if (ratingTerm.isValid()) { + term.addSubTerm(query.term()); term.addSubTerm(ratingTerm); - } - if (m_contentButton->isChecked()) { - query.setSearchString(text); - } else if (!text.isEmpty()) { - term.addSubTerm(Baloo::Term(QLatin1String("filename"), text)); + query.setTerm(term); } if (m_fromHereButton->isChecked()) { query.addCustomOption("includeFolder", m_searchPath.toLocalFile()); } - query.setTerm(term); - return query.toSearchUrl(i18nc("@title UDS_DISPLAY_NAME for a KIO directory listing. %1 is the query the user entered.", "Query Results from '%1'", text)); #else diff --git a/src/search/dolphinsearchbox.h b/src/search/dolphinsearchbox.h index 53b12ffab..eba81346d 100644 --- a/src/search/dolphinsearchbox.h +++ b/src/search/dolphinsearchbox.h @@ -24,6 +24,8 @@ #include #include +#include + class DolphinFacetsWidget; class KLineEdit; class KSeparator; @@ -32,6 +34,11 @@ class QScrollArea; class QLabel; class QVBoxLayout; +namespace Baloo { + class QueryBuilder; + class NaturalQueryParser; +} + /** * @brief Input box for searching files with or without Baloo. * @@ -134,10 +141,11 @@ private slots: void emitSearchRequest(); void emitCloseRequest(); void slotConfigurationChanged(); - void slotSearchTextChanged(const QString& text); - void slotReturnPressed(const QString& text); + void slotSearchTextChanged(); + void slotReturnPressed(); void slotFacetsButtonToggled(); void slotFacetChanged(); + void updateSearchInputParsing(); private: void initButton(QToolButton* button); @@ -164,7 +172,12 @@ private: QVBoxLayout* m_topLayout; QLabel* m_searchLabel; +#ifdef HAVE_BALOO + Baloo::QueryBuilder* m_searchInput; + QScopedPointer m_queryParser; +#else KLineEdit* m_searchInput; +#endif QScrollArea* m_optionsScrollArea; QToolButton* m_fileNameButton; QToolButton* m_contentButton; -- cgit v1.3.1 From a705337fab20e230a3f990624f5f7de3b2468b3f Mon Sep 17 00:00:00 2001 From: Montel Laurent Date: Tue, 7 Oct 2014 07:32:35 +0200 Subject: Convert to reverse dns --- src/CMakeLists.txt | 2 +- src/dolphin.desktop | 188 ------------------------------------------- src/org.kde.dolphin.desktop | 189 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 190 insertions(+), 189 deletions(-) delete mode 100755 src/dolphin.desktop create mode 100755 src/org.kde.dolphin.desktop (limited to 'src/CMakeLists.txt') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3ad68c7f2..c308bc09d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -324,7 +324,7 @@ install(TARGETS kio_filenamesearch DESTINATION ${PLUGIN_INSTALL_DIR}) ########### install files ############### -install( PROGRAMS dolphin.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} ) +install( PROGRAMS org.kde.dolphin.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} ) install( FILES settings/dolphin_directoryviewpropertysettings.kcfg settings/dolphin_generalsettings.kcfg settings/dolphin_compactmodesettings.kcfg diff --git a/src/dolphin.desktop b/src/dolphin.desktop deleted file mode 100755 index 9364ebbdf..000000000 --- a/src/dolphin.desktop +++ /dev/null @@ -1,188 +0,0 @@ -[Desktop Entry] -Name=Dolphin -Name[af]=Dolphin -Name[ar]=دولفين -Name[as]=Dolphin -Name[ast]=Dolphin -Name[be]=Dolphin -Name[be@latin]=Dolphin -Name[bg]=Dolphin -Name[bn]=ডলফিন -Name[bn_IN]=Dolphin -Name[bs]=Delfin -Name[ca]=Dolphin -Name[ca@valencia]=Dolphin -Name[cs]=Dolphin -Name[csb]=Dolphin -Name[da]=Dolphin -Name[de]=Dolphin -Name[el]=Dolphin -Name[en_GB]=Dolphin -Name[eo]=Dolphin -Name[es]=Dolphin -Name[et]=Dolphin -Name[eu]=Dolphin -Name[fi]=Dolphin -Name[fr]=Dolphin -Name[fy]=Dolfyn -Name[ga]=Dolphin -Name[gl]=Dolphin -Name[gu]=ડોલ્ફિન -Name[he]=Dolphin -Name[hi]=डॉल्फ़िन -Name[hne]=डाल्फिन -Name[hr]=Dolphin -Name[hsb]=Dolphin -Name[hu]=Dolphin -Name[ia]=Dolphin -Name[id]=Dolphin -Name[is]=Dolphin -Name[it]=Dolphin -Name[ja]=Dolphin -Name[ka]=Dolphin -Name[kk]=Dolphin -Name[km]=Dolphin -Name[kn]=ಡಾಲ್ಫಿನ್ -Name[ko]=Dolphin -Name[ku]=Dolphin -Name[lt]=Dolphin -Name[lv]=Dolphin -Name[mai]=डाल्फिन -Name[mk]=Делфин -Name[ml]=ഡോള്‍ഫിന്‍ -Name[mr]=डॉल्फिन -Name[ms]=Dolphin -Name[nb]=Dolphin -Name[nds]=Dolphin -Name[ne]=डल्फिन -Name[nl]=Dolphin -Name[nn]=Dolphin -Name[oc]=Dolphin -Name[or]=ଡଲଫିନ -Name[pa]=ਡਾਲਫਿਨ -Name[pl]=Dolphin -Name[pt]=Dolphin -Name[pt_BR]=Dolphin -Name[ro]=Dolphin -Name[ru]=Dolphin -Name[se]=Dolphin -Name[si]=ඩොල්ෆින් -Name[sk]=Dolphin -Name[sl]=Dolphin -Name[sr]=Делфин -Name[sr@ijekavian]=Делфин -Name[sr@ijekavianlatin]=Dolphin -Name[sr@latin]=Dolphin -Name[sv]=Dolphin -Name[ta]=டால்பின் -Name[te]=డాల్ఫిన్ -Name[tg]=Dolphin -Name[th]=ดอลฟิน -Name[tr]=Dolphin -Name[ug]=Dolphin -Name[uk]=Dolphin -Name[uz]=Dolphin -Name[uz@cyrillic]=Dolphin -Name[vi]=Dolphin -Name[wa]=Dolphin -Name[x-test]=xxDolphinxx -Name[zh_CN]=Dolphin -Name[zh_TW]=Dolphin -Exec=dolphin %i -caption %c %u -Icon=system-file-manager -Type=Application -X-DocPath=dolphin/index.html -Categories=Qt;KDE;System;FileTools;FileManager; -GenericName=File Manager -GenericName[af]=Lêerbestuurder -GenericName[ar]=مدير الملفات -GenericName[as]=নথিপত্ৰৰ পৰিচালক -GenericName[ast]=Xestor de ficheros -GenericName[be]=Кіраўнік файлаў -GenericName[be@latin]=Kiraŭnik fajłaŭ -GenericName[bg]=Файлов мениджър -GenericName[bn]=ফাইল ম্যানেজার -GenericName[bn_IN]=ফাইল পরিচালন ব্যবস্থা -GenericName[bs]=Menadžer datoteka -GenericName[ca]=Gestor de fitxers -GenericName[ca@valencia]=Gestor de fitxers -GenericName[cs]=Správce souborů -GenericName[csb]=Menadżera lopków -GenericName[da]=Filhåndtering -GenericName[de]=Dateimanager -GenericName[el]=Διαχειριστής αρχείων -GenericName[en_GB]=File Manager -GenericName[eo]=Dosieradministrilo -GenericName[es]=Gestor de archivos -GenericName[et]=Failihaldur -GenericName[eu]=Fitxategi-kudeatzailea -GenericName[fa]=مدیر پرونده -GenericName[fi]=Tiedostonhallinta -GenericName[fr]=Gestionnaire de fichiers -GenericName[fy]=Triembehearder -GenericName[ga]=Bainisteoir Comhad -GenericName[gl]=Xestor de ficheiros -GenericName[gu]=ફાઇલ વ્યવસ્થાપક -GenericName[he]=מנהל קבצים -GenericName[hi]=फ़ाइल प्रबंधक -GenericName[hne]=फाइल प्रबंधक -GenericName[hr]=Upravitelj datoteka -GenericName[hsb]=Datajowy manager -GenericName[hu]=Fájlkezelő -GenericName[ia]=Gerente de file -GenericName[id]=Manajer Berkas -GenericName[is]=Skráastjóri -GenericName[it]=Gestore dei file -GenericName[ja]=ファイルマネージャ -GenericName[ka]=ფაილების მმართველი -GenericName[kk]=Файл менеджері -GenericName[km]=កម្មវិធី​គ្រប់គ្រង​ឯកសារ -GenericName[kn]=ಕಡತ ವ್ಯವಸ್ಥಾಪಕ -GenericName[ko]=파일 관리자 -GenericName[ku]=Rêveberê Pelan -GenericName[lt]=Failų tvarkyklė -GenericName[lv]=Failu pārvaldnieks -GenericName[mai]=फाइल प्रबंधक -GenericName[mk]=Менаџер на датотеки -GenericName[ml]=ഫയല്‍ നടത്തിപ്പുകാരന്‍ -GenericName[mr]=फाईल व्यवस्थापक -GenericName[ms]=Pengurus Fail -GenericName[nb]=Filbehandler -GenericName[nds]=Dateipleger -GenericName[ne]=फाइल प्रबन्धक -GenericName[nl]=Bestandsbeheerder -GenericName[nn]=Filhandsamar -GenericName[oc]=Gestionari de fichièrs -GenericName[or]=ଫାଇଲ ପରିଚାଳକ -GenericName[pa]=ਫਾਇਲ ਮੈਨੇਜਰ -GenericName[pl]=Zarządzanie plikami -GenericName[pt]=Gestor de Ficheiros -GenericName[pt_BR]=Gerenciador de arquivos -GenericName[ro]=Gestionar de fișiere -GenericName[ru]=Диспетчер файлов -GenericName[se]=Fiilagieđahalli -GenericName[si]=ගොනු කළමනාකරු -GenericName[sk]=Správca súborov -GenericName[sl]=Upravljalnik datotek -GenericName[sr]=Менаџер фајлова -GenericName[sr@ijekavian]=Менаџер фајлова -GenericName[sr@ijekavianlatin]=Menadžer fajlova -GenericName[sr@latin]=Menadžer fajlova -GenericName[sv]=Filhanterare -GenericName[ta]=கோப்பு மேலாளர் -GenericName[te]=దస్త్రాల అభికర్త -GenericName[tg]=Мудири файлҳо -GenericName[th]=เครื่องมือจัดการแฟ้ม -GenericName[tr]=Dosya Yönetici -GenericName[ug]=ھۆججەت باشقۇرغۇ -GenericName[uk]=Менеджер файлів -GenericName[uz]=Fayl boshqaruvchisi -GenericName[uz@cyrillic]=Файл бошқарувчиси -GenericName[vi]=Bộ quản lý tập tin -GenericName[wa]=Manaedjeu di fitchîs -GenericName[x-test]=xxFile Managerxx -GenericName[zh_CN]=文件管理器 -GenericName[zh_TW]=檔案管理員 -Terminal=false -MimeType=inode/directory; -InitialPreference=10 diff --git a/src/org.kde.dolphin.desktop b/src/org.kde.dolphin.desktop new file mode 100755 index 000000000..e15a65cc6 --- /dev/null +++ b/src/org.kde.dolphin.desktop @@ -0,0 +1,189 @@ +[Desktop Entry] +Name=Dolphin +Name[af]=Dolphin +Name[ar]=دولفين +Name[as]=Dolphin +Name[ast]=Dolphin +Name[be]=Dolphin +Name[be@latin]=Dolphin +Name[bg]=Dolphin +Name[bn]=ডলফিন +Name[bn_IN]=Dolphin +Name[bs]=Delfin +Name[ca]=Dolphin +Name[ca@valencia]=Dolphin +Name[cs]=Dolphin +Name[csb]=Dolphin +Name[da]=Dolphin +Name[de]=Dolphin +Name[el]=Dolphin +Name[en_GB]=Dolphin +Name[eo]=Dolphin +Name[es]=Dolphin +Name[et]=Dolphin +Name[eu]=Dolphin +Name[fi]=Dolphin +Name[fr]=Dolphin +Name[fy]=Dolfyn +Name[ga]=Dolphin +Name[gl]=Dolphin +Name[gu]=ડોલ્ફિન +Name[he]=Dolphin +Name[hi]=डॉल्फ़िन +Name[hne]=डाल्फिन +Name[hr]=Dolphin +Name[hsb]=Dolphin +Name[hu]=Dolphin +Name[ia]=Dolphin +Name[id]=Dolphin +Name[is]=Dolphin +Name[it]=Dolphin +Name[ja]=Dolphin +Name[ka]=Dolphin +Name[kk]=Dolphin +Name[km]=Dolphin +Name[kn]=ಡಾಲ್ಫಿನ್ +Name[ko]=Dolphin +Name[ku]=Dolphin +Name[lt]=Dolphin +Name[lv]=Dolphin +Name[mai]=डाल्फिन +Name[mk]=Делфин +Name[ml]=ഡോള്‍ഫിന്‍ +Name[mr]=डॉल्फिन +Name[ms]=Dolphin +Name[nb]=Dolphin +Name[nds]=Dolphin +Name[ne]=डल्फिन +Name[nl]=Dolphin +Name[nn]=Dolphin +Name[oc]=Dolphin +Name[or]=ଡଲଫିନ +Name[pa]=ਡਾਲਫਿਨ +Name[pl]=Dolphin +Name[pt]=Dolphin +Name[pt_BR]=Dolphin +Name[ro]=Dolphin +Name[ru]=Dolphin +Name[se]=Dolphin +Name[si]=ඩොල්ෆින් +Name[sk]=Dolphin +Name[sl]=Dolphin +Name[sr]=Делфин +Name[sr@ijekavian]=Делфин +Name[sr@ijekavianlatin]=Dolphin +Name[sr@latin]=Dolphin +Name[sv]=Dolphin +Name[ta]=டால்பின் +Name[te]=డాల్ఫిన్ +Name[tg]=Dolphin +Name[th]=ดอลฟิน +Name[tr]=Dolphin +Name[ug]=Dolphin +Name[uk]=Dolphin +Name[uz]=Dolphin +Name[uz@cyrillic]=Dolphin +Name[vi]=Dolphin +Name[wa]=Dolphin +Name[x-test]=xxDolphinxx +Name[zh_CN]=Dolphin +Name[zh_TW]=Dolphin +Exec=dolphin %i -caption %c %u +Icon=system-file-manager +Type=Application +X-DocPath=dolphin/index.html +Categories=Qt;KDE;System;FileTools;FileManager; +GenericName=File Manager +GenericName[af]=Lêerbestuurder +GenericName[ar]=مدير الملفات +GenericName[as]=নথিপত্ৰৰ পৰিচালক +GenericName[ast]=Xestor de ficheros +GenericName[be]=Кіраўнік файлаў +GenericName[be@latin]=Kiraŭnik fajłaŭ +GenericName[bg]=Файлов мениджър +GenericName[bn]=ফাইল ম্যানেজার +GenericName[bn_IN]=ফাইল পরিচালন ব্যবস্থা +GenericName[bs]=Menadžer datoteka +GenericName[ca]=Gestor de fitxers +GenericName[ca@valencia]=Gestor de fitxers +GenericName[cs]=Správce souborů +GenericName[csb]=Menadżera lopków +GenericName[da]=Filhåndtering +GenericName[de]=Dateimanager +GenericName[el]=Διαχειριστής αρχείων +GenericName[en_GB]=File Manager +GenericName[eo]=Dosieradministrilo +GenericName[es]=Gestor de archivos +GenericName[et]=Failihaldur +GenericName[eu]=Fitxategi-kudeatzailea +GenericName[fa]=مدیر پرونده +GenericName[fi]=Tiedostonhallinta +GenericName[fr]=Gestionnaire de fichiers +GenericName[fy]=Triembehearder +GenericName[ga]=Bainisteoir Comhad +GenericName[gl]=Xestor de ficheiros +GenericName[gu]=ફાઇલ વ્યવસ્થાપક +GenericName[he]=מנהל קבצים +GenericName[hi]=फ़ाइल प्रबंधक +GenericName[hne]=फाइल प्रबंधक +GenericName[hr]=Upravitelj datoteka +GenericName[hsb]=Datajowy manager +GenericName[hu]=Fájlkezelő +GenericName[ia]=Gerente de file +GenericName[id]=Manajer Berkas +GenericName[is]=Skráastjóri +GenericName[it]=Gestore dei file +GenericName[ja]=ファイルマネージャ +GenericName[ka]=ფაილების მმართველი +GenericName[kk]=Файл менеджері +GenericName[km]=កម្មវិធី​គ្រប់គ្រង​ឯកសារ +GenericName[kn]=ಕಡತ ವ್ಯವಸ್ಥಾಪಕ +GenericName[ko]=파일 관리자 +GenericName[ku]=Rêveberê Pelan +GenericName[lt]=Failų tvarkyklė +GenericName[lv]=Failu pārvaldnieks +GenericName[mai]=फाइल प्रबंधक +GenericName[mk]=Менаџер на датотеки +GenericName[ml]=ഫയല്‍ നടത്തിപ്പുകാരന്‍ +GenericName[mr]=फाईल व्यवस्थापक +GenericName[ms]=Pengurus Fail +GenericName[nb]=Filbehandler +GenericName[nds]=Dateipleger +GenericName[ne]=फाइल प्रबन्धक +GenericName[nl]=Bestandsbeheerder +GenericName[nn]=Filhandsamar +GenericName[oc]=Gestionari de fichièrs +GenericName[or]=ଫାଇଲ ପରିଚାଳକ +GenericName[pa]=ਫਾਇਲ ਮੈਨੇਜਰ +GenericName[pl]=Zarządzanie plikami +GenericName[pt]=Gestor de Ficheiros +GenericName[pt_BR]=Gerenciador de arquivos +GenericName[ro]=Gestionar de fișiere +GenericName[ru]=Диспетчер файлов +GenericName[se]=Fiilagieđahalli +GenericName[si]=ගොනු කළමනාකරු +GenericName[sk]=Správca súborov +GenericName[sl]=Upravljalnik datotek +GenericName[sr]=Менаџер фајлова +GenericName[sr@ijekavian]=Менаџер фајлова +GenericName[sr@ijekavianlatin]=Menadžer fajlova +GenericName[sr@latin]=Menadžer fajlova +GenericName[sv]=Filhanterare +GenericName[ta]=கோப்பு மேலாளர் +GenericName[te]=దస్త్రాల అభికర్త +GenericName[tg]=Мудири файлҳо +GenericName[th]=เครื่องมือจัดการแฟ้ม +GenericName[tr]=Dosya Yönetici +GenericName[ug]=ھۆججەت باشقۇرغۇ +GenericName[uk]=Менеджер файлів +GenericName[uz]=Fayl boshqaruvchisi +GenericName[uz@cyrillic]=Файл бошқарувчиси +GenericName[vi]=Bộ quản lý tập tin +GenericName[wa]=Manaedjeu di fitchîs +GenericName[x-test]=xxFile Managerxx +GenericName[zh_CN]=文件管理器 +GenericName[zh_TW]=檔案管理員 +Terminal=false +MimeType=inode/directory; +InitialPreference=10 +X-DBUS-ServiceName=org.kde.dolphin -- cgit v1.3.1 From 93465171bc56f353796bad77e2accaa8d9fe9204 Mon Sep 17 00:00:00 2001 From: Vishesh Handa Date: Tue, 14 Oct 2014 15:51:51 +0200 Subject: Port Dolphin to the new Baloo APIs REVIEW: 120582 --- src/CMakeLists.txt | 3 +-- src/kitemviews/kfileitemmodelrolesupdater.cpp | 25 +++++++------------------ src/kitemviews/kfileitemmodelrolesupdater.h | 1 - src/kitemviews/private/kbaloorolesprovider.cpp | 8 +++++--- src/search/dolphinsearchbox.cpp | 8 ++++---- 5 files changed, 17 insertions(+), 28 deletions(-) (limited to 'src/CMakeLists.txt') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c308bc09d..523ee03a9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -104,8 +104,7 @@ if(HAVE_BALOO) target_link_libraries( dolphinprivate PUBLIC KF5::FileMetaData - KF5::BalooCore - KF5::BalooFiles + KF5::Baloo KF5::BalooNaturalQueryParser KF5::BalooWidgets ) diff --git a/src/kitemviews/kfileitemmodelrolesupdater.cpp b/src/kitemviews/kfileitemmodelrolesupdater.cpp index b8c56bd53..256527c9e 100644 --- a/src/kitemviews/kfileitemmodelrolesupdater.cpp +++ b/src/kitemviews/kfileitemmodelrolesupdater.cpp @@ -45,7 +45,6 @@ #ifdef HAVE_BALOO #include "private/kbaloorolesprovider.h" #include - #include #include #endif @@ -705,21 +704,8 @@ void KFileItemModelRolesUpdater::applyChangedBalooRoles(const QString& itemUrl) return; } - Baloo::FileFetchJob* job = new Baloo::FileFetchJob(item.localPath()); - connect(job, &Baloo::FileFetchJob::finished, this, &KFileItemModelRolesUpdater::applyChangedBalooRolesJobFinished); - job->setProperty("item", QVariant::fromValue(item)); - job->start(); -#else -#ifndef Q_CC_MSVC - Q_UNUSED(itemUrl); -#endif -#endif -} - -void KFileItemModelRolesUpdater::applyChangedBalooRolesJobFinished(KJob* kjob) -{ -#ifdef HAVE_BALOO - const KFileItem item = kjob->property("item").value(); + Baloo::File file(item.localPath()); + file.load(); const KBalooRolesProvider& rolesProvider = KBalooRolesProvider::instance(); QHash data; @@ -731,8 +717,7 @@ void KFileItemModelRolesUpdater::applyChangedBalooRolesJobFinished(KJob* kjob) data.insert(role, QVariant()); } - Baloo::FileFetchJob* job = static_cast(kjob); - QHashIterator it(rolesProvider.roleValues(job->file(), m_roles)); + QHashIterator it(rolesProvider.roleValues(file, m_roles)); while (it.hasNext()) { it.next(); data.insert(it.key(), it.value()); @@ -744,6 +729,10 @@ void KFileItemModelRolesUpdater::applyChangedBalooRolesJobFinished(KJob* kjob) m_model->setData(index, data); connect(m_model, &KFileItemModel::itemsChanged, this, &KFileItemModelRolesUpdater::slotItemsChanged); +#else +#ifndef Q_CC_MSVC + Q_UNUSED(itemUrl); +#endif #endif } diff --git a/src/kitemviews/kfileitemmodelrolesupdater.h b/src/kitemviews/kfileitemmodelrolesupdater.h index e9652e3b5..4a96b1f49 100644 --- a/src/kitemviews/kfileitemmodelrolesupdater.h +++ b/src/kitemviews/kfileitemmodelrolesupdater.h @@ -205,7 +205,6 @@ private slots: void resolveRecentlyChangedItems(); void applyChangedBalooRoles(const QString& file); - void applyChangedBalooRolesJobFinished(KJob* job); void slotDirectoryContentsCountReceived(const QString& path, int count); diff --git a/src/kitemviews/private/kbaloorolesprovider.cpp b/src/kitemviews/private/kbaloorolesprovider.cpp index 5096ef096..74f789e23 100644 --- a/src/kitemviews/private/kbaloorolesprovider.cpp +++ b/src/kitemviews/private/kbaloorolesprovider.cpp @@ -26,6 +26,7 @@ #include #include +#include #include #include @@ -99,14 +100,15 @@ QHash KBalooRolesProvider::roleValues(const Baloo::File& f } } + KFileMetaData::UserMetaData md(file.path()); if (roles.contains("tags")) { - values.insert("tags", tagsFromValues(file.tags())); + values.insert("tags", tagsFromValues(md.tags())); } if (roles.contains("rating")) { - values.insert("rating", QString::number(file.rating())); + values.insert("rating", QString::number(md.rating())); } if (roles.contains("comment")) { - values.insert("comment", file.userComment()); + values.insert("comment", md.userComment()); } return values; diff --git a/src/search/dolphinsearchbox.cpp b/src/search/dolphinsearchbox.cpp index de73c2c42..b8b1dbbca 100644 --- a/src/search/dolphinsearchbox.cpp +++ b/src/search/dolphinsearchbox.cpp @@ -479,7 +479,7 @@ KUrl DolphinSearchBox::balooUrlForSearching() const } if (m_fromHereButton->isChecked()) { - query.addCustomOption("includeFolder", m_searchPath.toLocalFile()); + query.setIncludeFolder(m_searchPath.toLocalFile()); } return query.toSearchUrl(i18nc("@title UDS_DISPLAY_NAME for a KIO directory listing. %1 is the query the user entered.", @@ -499,9 +499,9 @@ void DolphinSearchBox::fromBalooSearchUrl(const KUrl& url) // while we adjust the search text and the facet widget. blockSignals(true); - const QVariantMap customOptions = query.customOptions(); - if (customOptions.contains("includeFolder")) { - setSearchPath(customOptions.value("includeFolder").toString()); + const QString customDir = query.includeFolder(); + if (!customDir.isEmpty()) { + setSearchPath(customDir); } else { setSearchPath(QDir::homePath()); } -- cgit v1.3.1 From 3c74d908de8efc8e2578a69b528370c40bae7ca4 Mon Sep 17 00:00:00 2001 From: Emmanuel Pescosta Date: Mon, 20 Oct 2014 11:08:22 +0200 Subject: The filenamesearch ioslave has been moved to kio-extras, remove it from Dolphin. See commit 05689c462745edbaeebcfc63d456877746805451 in kio-extras --- src/CMakeLists.txt | 12 --- src/search/filenamesearch.protocol | 17 --- src/search/filenamesearchprotocol.cpp | 192 ---------------------------------- src/search/filenamesearchprotocol.h | 59 ----------- 4 files changed, 280 deletions(-) delete mode 100644 src/search/filenamesearch.protocol delete mode 100644 src/search/filenamesearchprotocol.cpp delete mode 100644 src/search/filenamesearchprotocol.h (limited to 'src/CMakeLists.txt') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 523ee03a9..339c1e5f8 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -310,17 +310,6 @@ install(TARGETS kcm_dolphinnavigation DESTINATION ${PLUGIN_INSTALL_DIR} ) install(TARGETS kcm_dolphinservices DESTINATION ${PLUGIN_INSTALL_DIR} ) install(TARGETS kcm_dolphingeneral DESTINATION ${PLUGIN_INSTALL_DIR} ) -######################################### - -set(kio_search_PART_SRCS - search/filenamesearchprotocol.cpp) - -add_library(kio_filenamesearch MODULE ${kio_search_PART_SRCS}) - -target_link_libraries(kio_filenamesearch KF5::KDELibs4Support) - -install(TARGETS kio_filenamesearch DESTINATION ${PLUGIN_INSTALL_DIR}) - ########### install files ############### install( PROGRAMS org.kde.dolphin.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} ) @@ -333,7 +322,6 @@ install( FILES settings/dolphin_directoryviewpropertysettings.kcfg DESTINATION ${KCFG_INSTALL_DIR} ) install( FILES dolphinui.rc DESTINATION ${CMAKE_INSTALL_KXMLGUI5DIR}/dolphin ) install( FILES dolphin.appdata.xml DESTINATION ${SHARE_INSTALL_PREFIX}/appdata ) -install( FILES search/filenamesearch.protocol DESTINATION ${SERVICES_INSTALL_DIR} ) install( FILES settings/kcm/kcmdolphinviewmodes.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) install( FILES settings/kcm/kcmdolphinnavigation.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) diff --git a/src/search/filenamesearch.protocol b/src/search/filenamesearch.protocol deleted file mode 100644 index 06aec0e6b..000000000 --- a/src/search/filenamesearch.protocol +++ /dev/null @@ -1,17 +0,0 @@ -[Protocol] -exec=kio_filenamesearch -protocol=filenamesearch -input=none -output=filesystem -reading=true -writing=false -deleting=true -linking=false -makedir=false -moving=false -listing=Name,Type,Size,Date,AccessDate,Access,Owner,Group,Link -source=false -Icon=edit-find -Class=:local -determineMimetypeFromExtension=false -maxInstances=10 diff --git a/src/search/filenamesearchprotocol.cpp b/src/search/filenamesearchprotocol.cpp deleted file mode 100644 index b56a99580..000000000 --- a/src/search/filenamesearchprotocol.cpp +++ /dev/null @@ -1,192 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2010 by Peter Penz * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program 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 General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ - -#include "filenamesearchprotocol.h" - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -FileNameSearchProtocol::FileNameSearchProtocol( const QByteArray &pool, const QByteArray &app ) : - SlaveBase("search", pool, app), - m_checkContent(false), - m_regExp(0), - m_iteratedDirs() -{ -} - -FileNameSearchProtocol::~FileNameSearchProtocol() -{ - cleanup(); -} - -void FileNameSearchProtocol::listDir(const QUrl& url) -{ - cleanup(); - - const QString search = url.queryItemValue("search"); - if (!search.isEmpty()) { - m_regExp = new QRegExp(search, Qt::CaseInsensitive, QRegExp::Wildcard); - } - - m_checkContent = false; - const QString checkContent = url.queryItemValue("checkContent"); - if (checkContent == QLatin1String("yes")) { - m_checkContent = true; - } - - const QString urlString = url.queryItemValue("url"); - searchDirectory(KUrl(urlString)); - - cleanup(); - finished(); -} - -void FileNameSearchProtocol::searchDirectory(const KUrl& directory) -{ - if (directory.path() == QLatin1String("/proc")) { - // Don't try to iterate the /proc directory of Linux - return; - } - - // Get all items of the directory - KDirLister *dirLister = new KDirLister(); - dirLister->setDelayedMimeTypes(false); - dirLister->setAutoErrorHandlingEnabled(false, 0); - dirLister->openUrl(directory); - - QEventLoop eventLoop; - QObject::connect(dirLister, static_cast(&KDirLister::canceled), &eventLoop, &QEventLoop::quit); - QObject::connect(dirLister, static_cast(&KDirLister::completed), &eventLoop, &QEventLoop::quit); - eventLoop.exec(); - - // Visualize all items that match the search pattern - QList pendingDirs; - const KFileItemList items = dirLister->items(); - foreach (const KFileItem& item, items) { - bool addItem = false; - if (!m_regExp || item.name().contains(*m_regExp)) { - addItem = true; - } else if (m_checkContent && item.determineMimeType().inherits(QLatin1String("text/plain"))) { - addItem = contentContainsPattern(item.url()); - } - - if (addItem) { - KIO::UDSEntry entry = item.entry(); - entry.insert(KIO::UDSEntry::UDS_URL, item.url().url() ); - listEntry(entry,false); - } - - if (item.isDir()) { - if (item.isLink()) { - // Assure that no endless searching is done in directories that - // have already been iterated. - const KUrl linkDest(item.url(), item.linkDest()); - if (!m_iteratedDirs.contains(linkDest.path())) { - pendingDirs.append(linkDest); - } - } else { - pendingDirs.append(item.url()); - } - } - } - listEntry(KIO::UDSEntry(), true); - - m_iteratedDirs.insert(directory.path()); - - delete dirLister; - dirLister = 0; - - // Recursively iterate all sub directories - foreach (const KUrl& pendingDir, pendingDirs) { - searchDirectory(pendingDir); - } -} - -bool FileNameSearchProtocol::contentContainsPattern(const KUrl& fileName) const -{ - Q_ASSERT(m_regExp); - - QString path; - KTemporaryFile tempFile; - - if (fileName.isLocalFile()) { - path = fileName.path(); - } else if (tempFile.open()) { - KIO::Job* getJob = KIO::file_copy(fileName, - tempFile.fileName(), - -1, - KIO::Overwrite | KIO::HideProgressInfo); - if (!KIO::NetAccess::synchronousRun(getJob, 0)) { - // The non-local file could not be downloaded - return false; - } - path = tempFile.fileName(); - } else { - // No temporary file could be created for downloading non-local files - return false; - } - - QFile file(path); - if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { - return false; - } - - QTextStream in(&file); - while (!in.atEnd()) { - const QString line = in.readLine(); - if (line.contains(*m_regExp)) { - return true; - } - } - - return false; -} - -void FileNameSearchProtocol::cleanup() -{ - delete m_regExp; - m_regExp = 0; - m_iteratedDirs.clear(); -} - -extern "C" int KDE_EXPORT kdemain( int argc, char **argv ) -{ - KComponentData instance("kio_search"); - QCoreApplication app(argc, argv); - - if (argc != 4) { - fprintf(stderr, "Usage: kio_filenamesearch protocol domain-socket1 domain-socket2\n"); - exit(-1); - } - - FileNameSearchProtocol slave(argv[2], argv[3]); - slave.dispatchLoop(); - - return 0; -} diff --git a/src/search/filenamesearchprotocol.h b/src/search/filenamesearchprotocol.h deleted file mode 100644 index 732aef942..000000000 --- a/src/search/filenamesearchprotocol.h +++ /dev/null @@ -1,59 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2010 by Peter Penz * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program 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 General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ - -#ifndef FILENAMESEARCHPROTOCOL_H -#define FILENAMESEARCHPROTOCOL_H - -#include - -class KUrl; -class QRegExp; - -/** - * @brief Lists files where the filename matches do a given query. - * - * The query is defined as part of the "search" query item of the URL. - * The directory where the searching is started is defined in the "url" query - * item. If the query item "checkContent" is set to "yes", all files with - * a text MIME type will be checked for the content. - */ -class FileNameSearchProtocol : public KIO::SlaveBase { -public: - FileNameSearchProtocol(const QByteArray& pool, const QByteArray& app); - virtual ~FileNameSearchProtocol(); - - virtual void listDir(const QUrl& url) Q_DECL_OVERRIDE; - -private: - void searchDirectory(const KUrl& directory); - - /** - * @return True, if the pattern m_searchPattern is part of - * the file \a fileName. - */ - bool contentContainsPattern(const KUrl& fileName) const; - - void cleanup(); - - bool m_checkContent; - QRegExp* m_regExp; - QSet m_iteratedDirs; -}; - -#endif -- cgit v1.3.1 From d9d7926c49c097fd1f5b72576e2c84c3989e89e7 Mon Sep 17 00:00:00 2001 From: Lukáš Tinkl Date: Tue, 21 Oct 2014 00:27:42 +0200 Subject: port Konqueror from KUrl to QUrl REVIEW: 120650 --- src/CMakeLists.txt | 2 +- src/dolphinapplication.cpp | 2 +- src/dolphinmainwindow.cpp | 4 +-- src/dolphinmainwindow.h | 4 +-- src/dolphinpart.cpp | 16 ++++----- src/dolphinpart.h | 12 +++---- src/dolphintabpage.cpp | 6 ++-- src/dolphintabpage.h | 6 ++-- src/dolphintabwidget.cpp | 14 ++++---- src/dolphintabwidget.h | 8 ++--- src/kitemviews/kfileitemmodel.cpp | 24 ++++++------- src/kitemviews/kfileitemmodel.h | 26 +++++++------- src/tests/kfileitemmodeltest.cpp | 75 +++++++++++++++++++++------------------ src/views/dolphinview.cpp | 34 +++++++++--------- src/views/dolphinview.h | 18 +++++----- 15 files changed, 129 insertions(+), 122 deletions(-) (limited to 'src/CMakeLists.txt') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 339c1e5f8..c07490805 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -138,7 +138,7 @@ target_link_libraries(dolphinpart install(TARGETS dolphinpart DESTINATION ${PLUGIN_INSTALL_DIR}) -install(FILES dolphinpart.rc DESTINATION ${DATA_INSTALL_DIR}/dolphinpart) +install(FILES dolphinpart.rc DESTINATION ${CMAKE_INSTALL_KXMLGUI5DIR}/dolphinpart) install(FILES dolphinpart.desktop DESTINATION ${SERVICES_INSTALL_DIR}) install(FILES views/versioncontrol/fileviewversioncontrolplugin.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR}) diff --git a/src/dolphinapplication.cpp b/src/dolphinapplication.cpp index 8a6b4cc03..8d4af66df 100644 --- a/src/dolphinapplication.cpp +++ b/src/dolphinapplication.cpp @@ -39,7 +39,7 @@ DolphinApplication::DolphinApplication() : const int argsCount = args->count(); - QList urls; + QList urls; for (int i = 0; i < argsCount; ++i) { const KUrl url = args->url(i); if (url.isValid()) { diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index 3f83d054b..1053f15b6 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -172,12 +172,12 @@ DolphinMainWindow::~DolphinMainWindow() { } -void DolphinMainWindow::openDirectories(const QList& dirs) +void DolphinMainWindow::openDirectories(const QList& dirs) { m_tabWidget->openDirectories(dirs); } -void DolphinMainWindow::openFiles(const QList& files) +void DolphinMainWindow::openFiles(const QList& files) { m_tabWidget->openFiles(files); } diff --git a/src/dolphinmainwindow.h b/src/dolphinmainwindow.h index 0505037ce..893394abc 100644 --- a/src/dolphinmainwindow.h +++ b/src/dolphinmainwindow.h @@ -76,14 +76,14 @@ public: * Opens each directory in \p dirs in a separate tab. If the "split view" * option is enabled, 2 directories are collected within one tab. */ - void openDirectories(const QList& dirs); + void openDirectories(const QList &dirs); /** * Opens the directory which contains the files \p files * and selects all files (implements the --select option * of Dolphin). */ - void openFiles(const QList& files); + void openFiles(const QList& files); /** * Returns the 'Create New...' sub menu which also can be shared diff --git a/src/dolphinpart.cpp b/src/dolphinpart.cpp index 6f84ab1d8..8146fce28 100644 --- a/src/dolphinpart.cpp +++ b/src/dolphinpart.cpp @@ -39,6 +39,7 @@ #include #include #include +#include #include "dolphinpart_ext.h" #include "dolphinnewfilemenu.h" @@ -66,8 +67,7 @@ DolphinPart::DolphinPart(QWidget* parentWidget, QObject* parent, const QVariantL ,m_removeAction(0) { Q_UNUSED(args) -#pragma message("TODO: port to KF5") - //setComponentData(DolphinPartFactory::componentData(), false); + setComponentData(*createAboutData(), false); m_extension = new DolphinPartBrowserExtension(this); // make sure that other apps using this part find Dolphin's view-file-columns icons @@ -381,7 +381,7 @@ void DolphinPart::slotItemsActivated(const KFileItemList& items) } } -void DolphinPart::createNewWindow(const KUrl& url) +void DolphinPart::createNewWindow(const QUrl& url) { // TODO: Check issue N176832 for the missing QAIV signal; task 177399 - maybe this code // should be moved into DolphinPart::slotItemActivated() @@ -390,7 +390,7 @@ void DolphinPart::createNewWindow(const KUrl& url) void DolphinPart::slotOpenContextMenu(const QPoint& pos, const KFileItem& _item, - const KUrl&, + const QUrl &, const QList& customActions) { KParts::BrowserExtension::PopupFlags popupFlags = KParts::BrowserExtension::DefaultPopupItems @@ -471,12 +471,12 @@ void DolphinPart::slotOpenContextMenu(const QPoint& pos, actionGroups); } -void DolphinPart::slotDirectoryRedirection(const KUrl& oldUrl, const KUrl& newUrl) +void DolphinPart::slotDirectoryRedirection(const QUrl &oldUrl, const QUrl &newUrl) { //kDebug() << oldUrl << newUrl << "currentUrl=" << url(); - if (oldUrl.equals(url(), KUrl::CompareWithoutTrailingSlash /* #207572 */)) { + if (oldUrl.matches(url(), QUrl::StripTrailingSlash /* #207572 */)) { KParts::ReadOnlyPart::setUrl(newUrl); - const QString prettyUrl = newUrl.pathOrUrl(); + const QString prettyUrl = newUrl.toDisplayString(QUrl::PreferLocalFile); emit m_extension->setLocationBarUrl(prettyUrl); } } @@ -585,7 +585,7 @@ void DolphinPart::createDirectory() m_newFileMenu->createDirectory(); } -void DolphinPart::setFilesToSelect(const KUrl::List& files) +void DolphinPart::setFilesToSelect(const QList& files) { if (files.isEmpty()) { return; diff --git a/src/dolphinpart.h b/src/dolphinpart.h index 18ea0bfbf..56e049b22 100644 --- a/src/dolphinpart.h +++ b/src/dolphinpart.h @@ -50,7 +50,7 @@ class DolphinPart : public KParts::ReadOnlyPart Q_PROPERTY( QString nameFilter READ nameFilter WRITE setNameFilter ) // Used by konqueror to implement the --select command-line option - Q_PROPERTY( KUrl::List filesToSelect READ filesToSelect WRITE setFilesToSelect ) + Q_PROPERTY( QList filesToSelect READ filesToSelect WRITE setFilesToSelect ) public: explicit DolphinPart(QWidget* parentWidget, QObject* parent, const QVariantList& args); @@ -131,7 +131,7 @@ private Q_SLOTS: /** * Creates a new window showing the content of \a url. */ - void createNewWindow(const KUrl& url); + void createNewWindow(const QUrl &url); /** * Opens the context menu on the current mouse position. * @pos Position in screen coordinates. @@ -143,7 +143,7 @@ private Q_SLOTS: */ void slotOpenContextMenu(const QPoint& pos, const KFileItem& item, - const KUrl& url, + const QUrl& url, const QList& customActions); /** @@ -152,7 +152,7 @@ private Q_SLOTS: * Testcase 1: fish://localhost * Testcase 2: showing a directory that is being renamed by another window (#180156) */ - void slotDirectoryRedirection(const KUrl& oldUrl, const KUrl& newUrl); + void slotDirectoryRedirection(const QUrl& oldUrl, const QUrl& newUrl); /** * Updates the state of the 'Edit' menu actions and emits @@ -220,8 +220,8 @@ private Q_SLOTS: /** * Called by konqueror --select */ - void setFilesToSelect(const KUrl::List& files); - KUrl::List filesToSelect() const { return KUrl::List(); } // silence moc + void setFilesToSelect(const QList &files); + QList filesToSelect() const { return QList(); } // silence moc virtual bool eventFilter(QObject*, QEvent*); diff --git a/src/dolphintabpage.cpp b/src/dolphintabpage.cpp index 763cd8f94..2d02ff049 100644 --- a/src/dolphintabpage.cpp +++ b/src/dolphintabpage.cpp @@ -25,7 +25,7 @@ #include #include -DolphinTabPage::DolphinTabPage(const KUrl& primaryUrl, const KUrl& secondaryUrl, QWidget* parent) : +DolphinTabPage::DolphinTabPage(const QUrl &primaryUrl, const QUrl &secondaryUrl, QWidget* parent) : QWidget(parent), m_primaryViewActive(true), m_splitViewEnabled(false) @@ -135,7 +135,7 @@ int DolphinTabPage::selectedItemsCount() const return selectedItemsCount; } -void DolphinTabPage::markUrlsAsSelected(const QList& urls) +void DolphinTabPage::markUrlsAsSelected(const QList& urls) { m_primaryViewContainer->view()->markUrlsAsSelected(urls); if (m_splitViewEnabled) { @@ -143,7 +143,7 @@ void DolphinTabPage::markUrlsAsSelected(const QList& urls) } } -void DolphinTabPage::markUrlAsCurrent(const KUrl& url) +void DolphinTabPage::markUrlAsCurrent(const QUrl& url) { m_primaryViewContainer->view()->markUrlAsCurrent(url); if (m_splitViewEnabled) { diff --git a/src/dolphintabpage.h b/src/dolphintabpage.h index 2a406f4a9..e4a5ad6c7 100644 --- a/src/dolphintabpage.h +++ b/src/dolphintabpage.h @@ -33,7 +33,7 @@ class DolphinTabPage : public QWidget Q_OBJECT public: - explicit DolphinTabPage(const KUrl& primaryUrl, const KUrl& secondaryUrl = KUrl(), QWidget* parent = 0); + explicit DolphinTabPage(const QUrl& primaryUrl, const QUrl& secondaryUrl = KUrl(), QWidget* parent = 0); /** * @return True if primary view is the active view in this tab. @@ -85,13 +85,13 @@ public: * gets selected if no loading of a directory has been triggered * by DolphinView::setUrl() or DolphinView::reload(). */ - void markUrlsAsSelected(const QList& urls); + void markUrlsAsSelected(const QList &urls); /** * Marks the item indicated by \p url to be scrolled to and as the * current item after directory DolphinView::url() has been loaded. */ - void markUrlAsCurrent(const KUrl& url); + void markUrlAsCurrent(const QUrl& url); /** * Sets the places selector visible, if \a visible is true. diff --git a/src/dolphintabwidget.cpp b/src/dolphintabwidget.cpp index 42a8aff09..65cc824f0 100644 --- a/src/dolphintabwidget.cpp +++ b/src/dolphintabwidget.cpp @@ -136,7 +136,7 @@ void DolphinTabWidget::openNewActivatedTab(const KUrl& primaryUrl, const KUrl& s setCurrentIndex(count() - 1); } -void DolphinTabWidget::openNewTab(const KUrl& primaryUrl, const KUrl& secondaryUrl) +void DolphinTabWidget::openNewTab(const QUrl& primaryUrl, const QUrl& secondaryUrl) { QWidget* focusWidget = QApplication::focusWidget(); @@ -155,17 +155,17 @@ void DolphinTabWidget::openNewTab(const KUrl& primaryUrl, const KUrl& secondaryU } } -void DolphinTabWidget::openDirectories(const QList& dirs) +void DolphinTabWidget::openDirectories(const QList& dirs) { const bool hasSplitView = GeneralSettings::splitView(); // Open each directory inside a new tab. If the "split view" option has been enabled, // always show two directories within one tab. - QList::const_iterator it = dirs.constBegin(); + QList::const_iterator it = dirs.constBegin(); while (it != dirs.constEnd()) { - const KUrl& primaryUrl = *(it++); + const QUrl& primaryUrl = *(it++); if (hasSplitView && (it != dirs.constEnd())) { - const KUrl& secondaryUrl = *(it++); + const QUrl& secondaryUrl = *(it++); openNewTab(primaryUrl, secondaryUrl); } else { openNewTab(primaryUrl); @@ -173,7 +173,7 @@ void DolphinTabWidget::openDirectories(const QList& dirs) } } -void DolphinTabWidget::openFiles(const QList& files) +void DolphinTabWidget::openFiles(const QList& files) { if (files.isEmpty()) { return; @@ -182,7 +182,7 @@ void DolphinTabWidget::openFiles(const QList& files) // Get all distinct directories from 'files' and open a tab // for each directory. If the "split view" option is enabled, two // directories are shown inside one tab (see openDirectories()). - QList dirs; + QList dirs; foreach (const KUrl& url, files) { const KUrl dir(url.directory()); if (!dirs.contains(dir)) { diff --git a/src/dolphintabwidget.h b/src/dolphintabwidget.h index 98bcd985a..c5ab8c260 100644 --- a/src/dolphintabwidget.h +++ b/src/dolphintabwidget.h @@ -95,20 +95,20 @@ public slots: * Opens a new tab in the background showing the URL \a primaryUrl and the * optional URL \a secondaryUrl. */ - void openNewTab(const KUrl& primaryUrl, const KUrl& secondaryUrl = KUrl()); + void openNewTab(const QUrl &primaryUrl, const QUrl &secondaryUrl = KUrl()); /** * Opens each directory in \p dirs in a separate tab. If the "split view" * option is enabled, 2 directories are collected within one tab. */ - void openDirectories(const QList& dirs); + void openDirectories(const QList& dirs); /** * Opens the directory which contains the files \p files * and selects all files (implements the --select option * of Dolphin). */ - void openFiles(const QList& files); + void openFiles(const QList &files); /** * Closes the currently active tab. @@ -187,4 +187,4 @@ private: bool m_placesSelectorVisible; }; -#endif \ No newline at end of file +#endif diff --git a/src/kitemviews/kfileitemmodel.cpp b/src/kitemviews/kfileitemmodel.cpp index 489e4edb4..524b4f59a 100644 --- a/src/kitemviews/kfileitemmodel.cpp +++ b/src/kitemviews/kfileitemmodel.cpp @@ -116,15 +116,15 @@ KFileItemModel::~KFileItemModel() qDeleteAll(m_pendingItemsToInsert); } -void KFileItemModel::loadDirectory(const KUrl& url) +void KFileItemModel::loadDirectory(const QUrl &url) { m_dirLister->openUrl(url); } -void KFileItemModel::refreshDirectory(const KUrl& url) +void KFileItemModel::refreshDirectory(const QUrl &url) { // Refresh all expanded directories first (Bug 295300) - QHashIterator expandedDirs(m_expandedDirs); + QHashIterator expandedDirs(m_expandedDirs); while (expandedDirs.hasNext()) { expandedDirs.next(); m_dirLister->openUrl(expandedDirs.value(), KDirLister::Reload); @@ -133,7 +133,7 @@ void KFileItemModel::refreshDirectory(const KUrl& url) m_dirLister->openUrl(url, KDirLister::Reload); } -KUrl KFileItemModel::directory() const +QUrl KFileItemModel::directory() const { return m_dirLister->url(); } @@ -353,7 +353,7 @@ KFileItem KFileItemModel::fileItem(int index) const return KFileItem(); } -KFileItem KFileItemModel::fileItem(const KUrl& url) const +KFileItem KFileItemModel::fileItem(const QUrl &url) const { const int indexForUrl = index(url); if (indexForUrl >= 0) { @@ -364,10 +364,10 @@ KFileItem KFileItemModel::fileItem(const KUrl& url) const int KFileItemModel::index(const KFileItem& item) const { - return index(KUrl(item.url())); + return index(item.url()); } -int KFileItemModel::index(const KUrl& url) const +int KFileItemModel::index(const QUrl& url) const { KUrl urlToFind = url; urlToFind.adjustPath(KUrl::RemoveTrailingSlash); @@ -592,17 +592,17 @@ int KFileItemModel::expandedParentsCount(int index) const return 0; } -QSet KFileItemModel::expandedDirectories() const +QSet KFileItemModel::expandedDirectories() const { return m_expandedDirs.values().toSet(); } -void KFileItemModel::restoreExpandedDirectories(const QSet& urls) +void KFileItemModel::restoreExpandedDirectories(const QSet &urls) { m_urlsToExpand = urls; } -void KFileItemModel::expandParentDirectories(const KUrl& url) +void KFileItemModel::expandParentDirectories(const QUrl &url) { const int pos = m_dirLister->url().path().length(); @@ -620,7 +620,7 @@ void KFileItemModel::expandParentDirectories(const KUrl& url) // KDirLister::open() must called at least once to trigger an initial // loading. The pending URLs that must be restored are handled // in slotCompleted(). - QSetIterator it2(m_urlsToExpand); + QSetIterator it2(m_urlsToExpand); while (it2.hasNext()) { const int idx = index(it2.next()); if (idx >= 0 && !isExpanded(idx)) { @@ -898,7 +898,7 @@ void KFileItemModel::slotCanceled() emit directoryLoadingCanceled(); } -void KFileItemModel::slotItemsAdded(const KUrl& directoryUrl, const KFileItemList& items) +void KFileItemModel::slotItemsAdded(const QUrl &directoryUrl, const KFileItemList& items) { Q_ASSERT(!items.isEmpty()); diff --git a/src/kitemviews/kfileitemmodel.h b/src/kitemviews/kfileitemmodel.h index 62a283d33..aea0341ea 100644 --- a/src/kitemviews/kfileitemmodel.h +++ b/src/kitemviews/kfileitemmodel.h @@ -56,13 +56,13 @@ public: * indicate the current state of the loading process. The items * of the directory are added after the loading has been completed. */ - void loadDirectory(const KUrl& url); + void loadDirectory(const QUrl& url); /** * Throws away all currently loaded items and refreshes the directory * by reloading all items again. */ - void refreshDirectory(const KUrl& url); + void refreshDirectory(const QUrl& url); /** * @return Parent directory of the items that are shown. In case @@ -70,7 +70,7 @@ public: * the root-parent of all items. * @see rootItem() */ - KUrl directory() const; + QUrl directory() const; /** * Cancels the loading of a directory which has been started by either @@ -126,7 +126,7 @@ public: * URL is found KFileItem::isNull() will be true for the returned * file-item. The runtime complexity of this call is O(1). */ - KFileItem fileItem(const KUrl& url) const; + KFileItem fileItem(const QUrl& url) const; /** * @return The index for the file-item \a item. -1 is returned if no file-item @@ -139,7 +139,7 @@ public: * @return The index for the URL \a url. -1 is returned if no file-item * is found. The amortized runtime complexity of this call is O(1). */ - int index(const KUrl& url) const; + int index(const QUrl &url) const; /** * @return Root item of all items representing the item @@ -163,19 +163,19 @@ public: virtual bool isExpandable(int index) const; virtual int expandedParentsCount(int index) const; - QSet expandedDirectories() const; + QSet expandedDirectories() const; /** * Marks the URLs in \a urls as sub-directories which were expanded previously. * After calling loadDirectory() or refreshDirectory() the marked sub-directories * will be expanded step-by-step. */ - void restoreExpandedDirectories(const QSet& urls); + void restoreExpandedDirectories(const QSet& urls); /** * Expands all parent-directories of the item \a url. */ - void expandParentDirectories(const KUrl& url); + void expandParentDirectories(const QUrl& url); void setNameFilter(const QString& nameFilter); QString nameFilter() const; @@ -251,13 +251,13 @@ signals: * Is emitted if a redirection from the current URL \a oldUrl * to the new URL \a newUrl has been done. */ - void directoryRedirection(const KUrl& oldUrl, const KUrl& newUrl); + void directoryRedirection(const QUrl& oldUrl, const QUrl& newUrl); /** * Is emitted when the URL passed by KFileItemModel::setUrl() represents a file. * In this case no signal errorMessage() will be emitted. */ - void urlIsFileError(const KUrl& url); + void urlIsFileError(const QUrl& url); protected: virtual void onGroupedSortingChanged(bool current); @@ -273,7 +273,7 @@ private slots: void slotCompleted(); void slotCanceled(); - void slotItemsAdded(const KUrl& directoryUrl, const KFileItemList& items); + void slotItemsAdded(const QUrl& directoryUrl, const KFileItemList& items); void slotItemsDeleted(const KFileItemList& items); void slotRefreshItems(const QList >& items); void slotClear(); @@ -489,11 +489,11 @@ private: mutable QList > m_groups; // Stores the URLs (key: target url, value: url) of the expanded directories. - QHash m_expandedDirs; + QHash m_expandedDirs; // URLs that must be expanded. The expanding is initially triggered in setExpanded() // and done step after step in slotCompleted(). - QSet m_urlsToExpand; + QSet m_urlsToExpand; friend class KFileItemModelLessThan; // Accesses lessThan() method friend class KFileItemModelRolesUpdater; // Accesses emitSortProgress() method diff --git a/src/tests/kfileitemmodeltest.cpp b/src/tests/kfileitemmodeltest.cpp index 3d505c766..758699dad 100644 --- a/src/tests/kfileitemmodeltest.cpp +++ b/src/tests/kfileitemmodeltest.cpp @@ -404,8 +404,9 @@ void KFileItemModelTest::testResortAfterChangingName() // We rename d.txt back to a.txt using the dir lister's refreshItems() signal. const KFileItem fileItemD = m_model->fileItem(2); KFileItem fileItemA = fileItemD; - KUrl urlA = fileItemA.url(); - urlA.setFileName("a.txt"); + QUrl urlA = fileItemA.url(); + urlA.adjusted(QUrl::RemoveFilename); + urlA.setPath(urlA.path() + "a.txt"); fileItemA.setUrl(urlA); m_model->slotRefreshItems(QList >() << qMakePair(fileItemD, fileItemA)); @@ -516,8 +517,10 @@ void KFileItemModelTest::testExpandItems() m_testDir->createFiles(files); // Store the URLs of all folders in a set. - QSet allFolders; - allFolders << KUrl(m_testDir->name() + 'a') << KUrl(m_testDir->name() + "a/a") << KUrl(m_testDir->name() + "a/a-1"); + QSet allFolders; + allFolders << QUrl::fromLocalFile(m_testDir->name() + 'a') + << QUrl::fromLocalFile(m_testDir->name() + "a/a") + << QUrl::fromLocalFile(m_testDir->name() + "a/a-1"); m_model->loadDirectory(m_testDir->url()); QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout)); @@ -535,7 +538,7 @@ void KFileItemModelTest::testExpandItems() QVERIFY(m_model->isExpanded(0)); QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout)); QCOMPARE(m_model->count(), 3); // 3 items: "a/", "a/a/", "a/a-1/" - QCOMPARE(m_model->expandedDirectories(), QSet() << KUrl(m_testDir->name() + 'a')); + QCOMPARE(m_model->expandedDirectories(), QSet() << QUrl(m_testDir->name() + 'a')); QCOMPARE(spyInserted.count(), 1); KItemRangeList itemRangeList = spyInserted.takeFirst().at(0).value(); @@ -551,7 +554,7 @@ void KFileItemModelTest::testExpandItems() QVERIFY(m_model->isExpanded(1)); QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout)); QCOMPARE(m_model->count(), 4); // 4 items: "a/", "a/a/", "a/a/1", "a/a-1/" - QCOMPARE(m_model->expandedDirectories(), QSet() << KUrl(m_testDir->name() + 'a') << KUrl(m_testDir->name() + "a/a")); + QCOMPARE(m_model->expandedDirectories(), QSet() << QUrl(m_testDir->name() + 'a') << QUrl(m_testDir->name() + "a/a")); QCOMPARE(spyInserted.count(), 1); itemRangeList = spyInserted.takeFirst().at(0).value(); @@ -580,7 +583,7 @@ void KFileItemModelTest::testExpandItems() m_model->setExpanded(0, false); QVERIFY(!m_model->isExpanded(0)); QCOMPARE(m_model->count(), 1); - QVERIFY(!m_model->expandedDirectories().contains(KUrl(m_testDir->name() + 'a'))); // TODO: Make sure that child URLs are also removed + QVERIFY(!m_model->expandedDirectories().contains(QUrl(m_testDir->name() + 'a'))); // TODO: Make sure that child URLs are also removed QCOMPARE(spyRemoved.count(), 1); itemRangeList = spyRemoved.takeFirst().at(0).value(); @@ -606,7 +609,7 @@ void KFileItemModelTest::testExpandItems() // Move to a sub folder, then call restoreExpandedFolders() *before* going back. // This is how DolphinView restores the expanded folders when navigating in history. - m_model->loadDirectory(KUrl(m_testDir->name() + "a/a/")); + m_model->loadDirectory(QUrl(m_testDir->name() + "a/a/")); QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(directoryLoadingCompleted()), DefaultTimeout)); QCOMPARE(m_model->count(), 1); // 1 item: "1" m_model->restoreExpandedDirectories(allFolders); @@ -620,7 +623,7 @@ void KFileItemModelTest::testExpandItems() m_model->setRoles(originalModelRoles); QVERIFY(!m_model->isExpanded(0)); QCOMPARE(m_model->count(), 1); - QVERIFY(!m_model->expandedDirectories().contains(KUrl(m_testDir->name() + 'a'))); + QVERIFY(!m_model->expandedDirectories().contains(QUrl(m_testDir->name() + 'a'))); QCOMPARE(spyRemoved.count(), 1); itemRangeList = spyRemoved.takeFirst().at(0).value(); @@ -654,7 +657,7 @@ void KFileItemModelTest::testExpandParentItems() QVERIFY(m_model->expandedDirectories().empty()); // Expand the parents of "a2/b2/c2". - m_model->expandParentDirectories(KUrl(m_testDir->name() + "a2/b2/c2")); + m_model->expandParentDirectories(QUrl(m_testDir->name() + "a2/b2/c2")); QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(directoryLoadingCompleted()), DefaultTimeout)); // The model should now contain "a 1/", "a2/", "a2/b2/", and "a2/b2/c2/". @@ -666,7 +669,7 @@ void KFileItemModelTest::testExpandParentItems() QVERIFY(!m_model->isExpanded(3)); // Expand the parents of "a 1/b1". - m_model->expandParentDirectories(KUrl(m_testDir->name() + "a 1/b1")); + m_model->expandParentDirectories(QUrl(m_testDir->name() + "a 1/b1")); QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(directoryLoadingCompleted()), DefaultTimeout)); // The model should now contain "a 1/", "a 1/b1/", "a2/", "a2/b2", and "a2/b2/c2/". @@ -822,11 +825,11 @@ void KFileItemModelTest::testSorting() m_model->loadDirectory(m_testDir->url()); QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout)); - int index = m_model->index(KUrl(m_testDir->url().url() + 'c')); + int index = m_model->index(QUrl(m_testDir->url().url() + 'c')); m_model->setExpanded(index, true); QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout)); - index = m_model->index(KUrl(m_testDir->url().url() + "c/c-2")); + index = m_model->index(QUrl(m_testDir->url().url() + "c/c-2")); m_model->setExpanded(index, true); QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout)); @@ -1021,10 +1024,10 @@ void KFileItemModelTest::testEmptyPath() roles.insert("expandedParentsCount"); m_model->setRoles(roles); - const KUrl emptyUrl; + const QUrl emptyUrl; QVERIFY(emptyUrl.path().isEmpty()); - const KUrl url("file:///test/"); + const QUrl url("file:///test/"); KFileItemList items; items << KFileItem(emptyUrl, QString(), KFileItem::Unknown) << KFileItem(url, QString(), KFileItem::Unknown); @@ -1251,28 +1254,28 @@ void KFileItemModelTest::testGeneralParentChildRelationships() QCOMPARE(itemsInModel(), QStringList() << "parent1" << "realChild1" << "realGrandChild1" << "parent2" << "realChild2" << "realGrandChild2"); // Add some more children and grand-children. - const KUrl parent1 = m_model->fileItem(0).url(); - const KUrl parent2 = m_model->fileItem(3).url(); - const KUrl realChild1 = m_model->fileItem(1).url(); - const KUrl realChild2 = m_model->fileItem(4).url(); + const QUrl parent1 = m_model->fileItem(0).url(); + const QUrl parent2 = m_model->fileItem(3).url(); + const QUrl realChild1 = m_model->fileItem(1).url(); + const QUrl realChild2 = m_model->fileItem(4).url(); - m_model->slotItemsAdded(parent1, KFileItemList() << KFileItem(KUrl("child1"), QString(), KFileItem::Unknown)); + m_model->slotItemsAdded(parent1, KFileItemList() << KFileItem(QUrl("child1"), QString(), KFileItem::Unknown)); m_model->slotCompleted(); QCOMPARE(itemsInModel(), QStringList() << "parent1" << "realChild1" << "realGrandChild1" << "child1" << "parent2" << "realChild2" << "realGrandChild2"); - m_model->slotItemsAdded(parent2, KFileItemList() << KFileItem(KUrl("child2"), QString(), KFileItem::Unknown)); + m_model->slotItemsAdded(parent2, KFileItemList() << KFileItem(QUrl("child2"), QString(), KFileItem::Unknown)); m_model->slotCompleted(); QCOMPARE(itemsInModel(), QStringList() << "parent1" << "realChild1" << "realGrandChild1" << "child1" << "parent2" << "realChild2" << "realGrandChild2" << "child2"); - m_model->slotItemsAdded(realChild1, KFileItemList() << KFileItem(KUrl("grandChild1"), QString(), KFileItem::Unknown)); + m_model->slotItemsAdded(realChild1, KFileItemList() << KFileItem(QUrl("grandChild1"), QString(), KFileItem::Unknown)); m_model->slotCompleted(); QCOMPARE(itemsInModel(), QStringList() << "parent1" << "realChild1" << "grandChild1" << "realGrandChild1" << "child1" << "parent2" << "realChild2" << "realGrandChild2" << "child2"); - m_model->slotItemsAdded(realChild1, KFileItemList() << KFileItem(KUrl("grandChild1"), QString(), KFileItem::Unknown)); + m_model->slotItemsAdded(realChild1, KFileItemList() << KFileItem(QUrl("grandChild1"), QString(), KFileItem::Unknown)); m_model->slotCompleted(); QCOMPARE(itemsInModel(), QStringList() << "parent1" << "realChild1" << "grandChild1" << "realGrandChild1" << "child1" << "parent2" << "realChild2" << "realGrandChild2" << "child2"); - m_model->slotItemsAdded(realChild2, KFileItemList() << KFileItem(KUrl("grandChild2"), QString(), KFileItem::Unknown)); + m_model->slotItemsAdded(realChild2, KFileItemList() << KFileItem(QUrl("grandChild2"), QString(), KFileItem::Unknown)); m_model->slotCompleted(); QCOMPARE(itemsInModel(), QStringList() << "parent1" << "realChild1" << "grandChild1" << "realGrandChild1" << "child1" << "parent2" << "realChild2" << "grandChild2" << "realGrandChild2" << "child2"); @@ -1355,8 +1358,9 @@ void KFileItemModelTest::testNameRoleGroups() // Change d.txt back to c.txt, but this time using the dir lister's refreshItems() signal. const KFileItem fileItemD = m_model->fileItem(2); KFileItem fileItemC = fileItemD; - KUrl urlC = fileItemC.url(); - urlC.setFileName("c.txt"); + QUrl urlC = fileItemC.url(); + urlC.adjusted(QUrl::RemoveFilename); + urlC.setPath(urlC.path() + "c.txt"); fileItemC.setUrl(urlC); m_model->slotRefreshItems(QList >() << qMakePair(fileItemD, fileItemC)); @@ -1445,7 +1449,7 @@ void KFileItemModelTest::testInconsistentModel() // Note that the first item in the list of added items must be new (i.e., not // in the model yet). Otherwise, KFileItemModel::slotItemsAdded() will see that // it receives items that are in the model already and ignore them. - KUrl url(m_model->directory().url() + "/a2"); + QUrl url(m_model->directory().url() + "/a2"); KFileItem newItem(KFileItem::Unknown, KFileItem::Unknown, url); KFileItemList items; @@ -1582,8 +1586,9 @@ void KFileItemModelTest::testRefreshFilteredItems() // Rename one of the .jpg files. KFileItem fileItemE = fileItemC; - KUrl urlE = fileItemE.url(); - urlE.setFileName("e.jpg"); + QUrl urlE = fileItemE.url(); + urlE.adjusted(QUrl::RemoveFilename); + urlE.setPath(urlE.path() + "e.jpg"); fileItemE.setUrl(urlE); m_model->slotRefreshItems(QList >() << qMakePair(fileItemC, fileItemE)); @@ -1650,11 +1655,12 @@ void KFileItemModelTest::testCollapseFolderWhileLoading() // signal is not emitted yet. const KFileItem fileItemC1 = m_model->fileItem(2); KFileItem fileItemC2 = fileItemC1; - KUrl urlC2 = fileItemC2.url(); - urlC2.setFileName("c2.txt"); + QUrl urlC2 = fileItemC2.url(); + urlC2.adjusted(QUrl::RemoveFilename); + urlC2.setPath(urlC2.path() + "c2.txt"); fileItemC2.setUrl(urlC2); - const KUrl urlB = m_model->fileItem(1).url(); + const QUrl urlB = m_model->fileItem(1).url(); m_model->slotItemsAdded(urlB, KFileItemList() << fileItemC2); QCOMPARE(itemsInModel(), QStringList() << "a2" << "b" << "c1.txt"); @@ -1681,8 +1687,9 @@ void KFileItemModelTest::testCollapseFolderWhileLoading() // completed() signal is not emitted yet. const KFileItem fileItemA2 = m_model->fileItem(0); KFileItem fileItemA1 = fileItemA2; - KUrl urlA1 = fileItemA1.url(); - urlA1.setFileName("a1"); + QUrl urlA1 = fileItemA1.url(); + urlA1.adjusted(QUrl::RemoveFilename); + urlA1.setPath(urlA1.path() + "a1"); fileItemA1.setUrl(urlA1); m_model->slotItemsAdded(m_model->directory(), KFileItemList() << fileItemA1); diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp index 4ed32ed43..3e35be54b 100644 --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -80,7 +80,7 @@ namespace { const int MaxModeEnum = DolphinView::CompactView; }; -DolphinView::DolphinView(const KUrl& url, QWidget* parent) : +DolphinView::DolphinView(const QUrl& url, QWidget* parent) : QWidget(parent), m_active(true), m_tabsForFiles(false), @@ -203,7 +203,7 @@ DolphinView::~DolphinView() { } -KUrl DolphinView::url() const +QUrl DolphinView::url() const { return m_url; } @@ -362,12 +362,12 @@ int DolphinView::selectedItemsCount() const return selectionManager->selectedItems().count(); } -void DolphinView::markUrlsAsSelected(const QList& urls) +void DolphinView::markUrlsAsSelected(const QList& urls) { m_selectedUrls = urls; } -void DolphinView::markUrlAsCurrent(const KUrl& url) +void DolphinView::markUrlAsCurrent(const QUrl &url) { m_currentItemUrl = url; m_scrollToCurrentItem = true; @@ -1049,7 +1049,7 @@ void DolphinView::slotItemDropEvent(int index, QGraphicsSceneDragDropEvent* even // Mark the dropped urls as selected. m_clearSelectionBeforeSelectingNewItems = true; m_markFirstNewlySelectedItemAsCurrent = true; - connect(op, static_cast(&KonqOperations::aboutToCreate), this, &DolphinView::slotAboutToCreate); + connect(op, static_cast&)>(&KonqOperations::aboutToCreate), this, &DolphinView::slotAboutToCreate); } setActive(true); @@ -1085,14 +1085,14 @@ void DolphinView::slotMouseButtonPressed(int itemIndex, Qt::MouseButtons buttons } } -void DolphinView::slotAboutToCreate(const KUrl::List& urls) +void DolphinView::slotAboutToCreate(const QList& urls) { if (!urls.isEmpty()) { if (m_markFirstNewlySelectedItemAsCurrent) { markUrlAsCurrent(urls.first()); m_markFirstNewlySelectedItemAsCurrent = false; } - m_selectedUrls << KUrl::List(KDirModel::simplifiedUrlList(urls)); + m_selectedUrls << KDirModel::simplifiedUrlList(urls); } } @@ -1184,7 +1184,7 @@ void DolphinView::restoreState(QDataStream& stream) stream >> m_restoredContentsPosition; // Restore expanded folders (only relevant for the details view - will be ignored by the view in other view modes) - QSet urls; + QSet urls; stream >> urls; m_model->restoreExpandedDirectories(urls); } @@ -1271,18 +1271,18 @@ KUrl DolphinView::openItemAsFolderUrl(const KFileItem& item, const bool browseTh return KUrl(); } -void DolphinView::observeCreatedItem(const KUrl& url) +void DolphinView::observeCreatedItem(const QUrl& url) { if (m_active) { clearSelection(); markUrlAsCurrent(url); - markUrlsAsSelected(QList() << url); + markUrlsAsSelected(QList() << url); } } -void DolphinView::slotDirectoryRedirection(const KUrl& oldUrl, const KUrl& newUrl) +void DolphinView::slotDirectoryRedirection(const QUrl& oldUrl, const QUrl& newUrl) { - if (oldUrl.equals(url(), KUrl::CompareWithoutTrailingSlash)) { + if (oldUrl.matches(url(), QUrl::StripTrailingSlash)) { emit redirection(oldUrl, newUrl); m_url = newUrl; // #186947 } @@ -1290,7 +1290,7 @@ void DolphinView::slotDirectoryRedirection(const KUrl& oldUrl, const KUrl& newUr void DolphinView::updateViewState() { - if (m_currentItemUrl != KUrl()) { + if (m_currentItemUrl != QUrl()) { KItemListSelectionManager* selectionManager = m_container->controller()->selectionManager(); const int currentIndex = m_model->index(m_currentItemUrl); if (currentIndex != -1) { @@ -1305,7 +1305,7 @@ void DolphinView::updateViewState() selectionManager->setCurrentItem(0); } - m_currentItemUrl = KUrl(); + m_currentItemUrl = QUrl(); } if (!m_restoredContentsPosition.isNull()) { @@ -1327,7 +1327,7 @@ void DolphinView::updateViewState() KItemSet selectedItems = selectionManager->selectedItems(); - QList::iterator it = m_selectedUrls.begin(); + QList::iterator it = m_selectedUrls.begin(); while (it != m_selectedUrls.end()) { const int index = m_model->index(*it); if (index >= 0) { @@ -1389,7 +1389,7 @@ void DolphinView::slotRenamingResult(KJob* job) KIO::CopyJob *copyJob = qobject_cast(job); Q_ASSERT(copyJob); const QUrl newUrl = copyJob->destUrl(); - const int index = m_model->index(KUrl(newUrl)); + const int index = m_model->index(newUrl); if (index >= 0) { QHash data; const QUrl oldUrl = copyJob->srcUrls().first(); @@ -1650,7 +1650,7 @@ void DolphinView::pasteToUrl(const KUrl& url) if (op) { m_clearSelectionBeforeSelectingNewItems = true; m_markFirstNewlySelectedItemAsCurrent = true; - connect(op, static_cast(&KonqOperations::aboutToCreate), this, &DolphinView::slotAboutToCreate); + connect(op, static_cast&)>(&KonqOperations::aboutToCreate), this, &DolphinView::slotAboutToCreate); } } diff --git a/src/views/dolphinview.h b/src/views/dolphinview.h index d6daf2826..9435206d9 100644 --- a/src/views/dolphinview.h +++ b/src/views/dolphinview.h @@ -92,7 +92,7 @@ public: * @param url Specifies the content which should be shown. * @param parent Parent widget of the view. */ - DolphinView(const KUrl& url, QWidget* parent); + DolphinView(const QUrl& url, QWidget* parent); virtual ~DolphinView(); @@ -100,7 +100,7 @@ public: * Returns the current active URL, where all actions are applied. * The URL navigator is synchronized with this URL. */ - KUrl url() const; + QUrl url() const; /** * If \a active is true, the view will marked as active. The active @@ -173,13 +173,13 @@ public: * gets selected if no loading of a directory has been triggered * by DolphinView::setUrl() or DolphinView::reload(). */ - void markUrlsAsSelected(const QList& urls); + void markUrlsAsSelected(const QList &urls); /** * Marks the item indicated by \p url to be scrolled to and as the * current item after directory DolphinView::url() has been loaded. */ - void markUrlAsCurrent(const KUrl& url); + void markUrlAsCurrent(const QUrl& url); /** * All items that match to the pattern \a pattern will get selected @@ -573,7 +573,7 @@ private slots: /* * Is called when new items get pasted or dropped. */ - void slotAboutToCreate(const KUrl::List& urls); + void slotAboutToCreate(const QList &urls); /** * Emits the signal \a selectionChanged() with a small delay. This is @@ -669,13 +669,13 @@ private slots: * model indicates that the item is available, the item will * get selected and it is assured that the item stays visible. */ - void observeCreatedItem(const KUrl& url); + void observeCreatedItem(const QUrl &url); /** * Called when a redirection happens. * Testcase: fish://localhost */ - void slotDirectoryRedirection(const KUrl& oldUrl, const KUrl& newUrl); + void slotDirectoryRedirection(const QUrl& oldUrl, const QUrl& newUrl); /** * Applies the state that has been restored by restoreViewState() @@ -772,11 +772,11 @@ private: QTimer* m_selectionChangedTimer; - KUrl m_currentItemUrl; // Used for making the view to remember the current URL after F5 + QUrl m_currentItemUrl; // Used for making the view to remember the current URL after F5 bool m_scrollToCurrentItem; // Used for marking we need to scroll to current item or not QPoint m_restoredContentsPosition; - QList m_selectedUrls; // Used for making the view to remember selections after F5 + QList m_selectedUrls; // Used for making the view to remember selections after F5 bool m_clearSelectionBeforeSelectingNewItems; bool m_markFirstNewlySelectedItemAsCurrent; -- cgit v1.3.1 From 3e5f78a1ccf84313c73ff7fe14e8ec9cfa3f71bf Mon Sep 17 00:00:00 2001 From: Luca Beltrame Date: Thu, 20 Nov 2014 09:28:11 +0100 Subject: Fix build after review 121078 RR 121078 fixed exports, but did not include the necessary generate_export_header in the CMakeLists.txt. Please, if you are testing for Windows, ensure you also test your build in Linux (and with a clean build dir). The fact that kde-baseapps for KF5 is still unreleased does not mean it should not be buildable. CCMAIL: andriusmao@gmail.com --- src/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/CMakeLists.txt') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c07490805..8e13e97fe 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -93,6 +93,9 @@ kconfig_add_kcfg_files(dolphinprivate_LIB_SRCS add_library(dolphinprivate ${dolphinprivate_LIB_SRCS}) +generate_export_header(dolphinprivate BASE_NAME libdolphinprivate + EXPORT_FILE_NAME libdolphin_export.h) + target_link_libraries( dolphinprivate PUBLIC KF5::KDELibs4Support -- cgit v1.3.1 From 68df2a725e77972b56e0831409bdf1c744208f17 Mon Sep 17 00:00:00 2001 From: Emmanuel Pescosta Date: Sun, 14 Dec 2014 17:47:58 +0100 Subject: show warnings about deprecated declarations --- src/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) (limited to 'src/CMakeLists.txt') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8e13e97fe..f132e2844 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -4,7 +4,6 @@ configure_file(config-baloo.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-baloo.h) configure_file(config-dolphin.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-dolphin.h) add_definitions(-DTRANSLATION_DOMAIN=\"dolphin\") -add_definitions(-Wno-deprecated-declarations) remove_definitions(-DQT_NO_CAST_FROM_BYTEARRAY -DQT_NO_URL_CAST_FROM_STRING) if(X11_Xrender_FOUND) -- cgit v1.3.1 From 088b5160576c8ed317619855a4c9dc19a69d025b Mon Sep 17 00:00:00 2001 From: Gregor Mi Date: Mon, 12 Jan 2015 16:18:50 +0100 Subject: Add disk usage statistics menu to SpaceInfo widget in the status bar: the menu has the following entries: 1. Filelight location 2. Filelight device 3. Filelight 4. KDiskFree KService is used to find the applications and display proper translations. KRun is used to run the applications. REVIEW: 121478 CHANGELOG: Add a menu on left-click on the SpaceInfo widget in the status bar to show Disk Usage statistics. --- src/CMakeLists.txt | 1 + src/statusbar/spaceinfotoolsmenu.cpp | 103 +++++++++++++++++++++++++++++++++++ src/statusbar/spaceinfotoolsmenu.h | 41 ++++++++++++++ src/statusbar/statusbarspaceinfo.cpp | 11 ++++ src/statusbar/statusbarspaceinfo.h | 2 + 5 files changed, 158 insertions(+) create mode 100644 src/statusbar/spaceinfotoolsmenu.cpp create mode 100644 src/statusbar/spaceinfotoolsmenu.h (limited to 'src/CMakeLists.txt') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f132e2844..d2ea49314 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -198,6 +198,7 @@ set(dolphin_SRCS statusbar/dolphinstatusbar.cpp statusbar/mountpointobserver.cpp statusbar/mountpointobservercache.cpp + statusbar/spaceinfotoolsmenu.cpp statusbar/spaceinfoobserver.cpp statusbar/statusbarspaceinfo.cpp views/zoomlevelinfo.cpp diff --git a/src/statusbar/spaceinfotoolsmenu.cpp b/src/statusbar/spaceinfotoolsmenu.cpp new file mode 100644 index 000000000..bd3d648c9 --- /dev/null +++ b/src/statusbar/spaceinfotoolsmenu.cpp @@ -0,0 +1,103 @@ +/*************************************************************************** + * Copyright (C) 2014 by Gregor Mi * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program 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 General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***************************************************************************/ + +#include "spaceinfotoolsmenu.h" + +#include +#include + +#include +#include +#include +#include + +SpaceInfoToolsMenu::SpaceInfoToolsMenu(QWidget* parent, QUrl url) + : QMenu(parent) +{ + const QString notInstalled = " [" + i18nc("@action:inmenu", "not installed") + "]"; + + // find service + // + const auto filelightService = KService::serviceByDesktopName("filelight"); + if (filelightService && filelightService->isApplication()) { + const auto filelightIcon = QIcon::fromTheme(filelightService->icon()); + + if (url.isLocalFile()) { // 2015-01-12: Filelight can handle FTP connections but KIO/kioexec cannot (bug or feature?), so we don't offer it in this case + // add action and connect signals + // + const auto startFilelightDirectoryAction = addAction(filelightService->genericName() + " - " + + i18nc("@action:inmenu", "current folder")); + startFilelightDirectoryAction->setIcon(filelightIcon); + + connect(startFilelightDirectoryAction, &QAction::triggered, this, [filelightService, url](bool) { + KRun::runService(*filelightService, { url }, nullptr); + }); + } + + if (url.isLocalFile()) { // makes no sense for non-local URLs (e.g. FTP server), so we don't offer it in this case + // add action and connect signals + // + const auto startFilelightDeviceAction = addAction(filelightService->genericName() + " - " + + i18nc("@action:inmenu", "current device")); + startFilelightDeviceAction->setIcon(filelightIcon); + + connect(startFilelightDeviceAction, &QAction::triggered, this, [filelightService, url](bool) { + KMountPoint::Ptr mountPoint = KMountPoint::currentMountPoints().findByPath(url.toLocalFile()); + KRun::runService(*filelightService, { mountPoint->mountPoint() }, nullptr); + }); + } + + // add action and connect signals + // + const auto startFilelightAllDevicesAction = addAction(filelightService->genericName() + " - " + + i18nc("@action:inmenu", "all devices")); + startFilelightAllDevicesAction->setIcon(filelightIcon); + + connect(startFilelightAllDevicesAction, &QAction::triggered, this, [filelightService](bool) { + KRun::runService(*filelightService, { }, nullptr); + }); + } else { + const auto startFilelightDirectoryAction = addAction("Filelight" + notInstalled); + startFilelightDirectoryAction->setEnabled(false); + } + + // find service + // + const auto kdiskfreeService = KService::serviceByDesktopName("kdf"); + if (kdiskfreeService && kdiskfreeService->isApplication()) { + // + // add action and connect signals + // + const auto startKDiskFreeAction = addAction(kdiskfreeService->genericName()); + startKDiskFreeAction->setIcon(QIcon::fromTheme(kdiskfreeService->icon())); + + connect(startKDiskFreeAction, &QAction::triggered, this, [kdiskfreeService](bool) { + KRun::runService(*kdiskfreeService, { }, nullptr); + }); + } else { + const auto startKDiskFreeAction = addAction("KDiskFree" + notInstalled); + startKDiskFreeAction->setEnabled(false); + } +} + +SpaceInfoToolsMenu::~SpaceInfoToolsMenu() +{ +} + + diff --git a/src/statusbar/spaceinfotoolsmenu.h b/src/statusbar/spaceinfotoolsmenu.h new file mode 100644 index 000000000..3ca2e184f --- /dev/null +++ b/src/statusbar/spaceinfotoolsmenu.h @@ -0,0 +1,41 @@ +/*************************************************************************** + * Copyright (C) 2014 by Gregor Mi * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program 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 General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***************************************************************************/ + +#ifndef SPACEINFOTOOLSMENU_H +#define SPACEINFOTOOLSMENU_H + +#include +#include + +class QWidget; +class QUrl; + +/** + * A menu with tools that help to find out more about free disk space for the given url. + */ +class SpaceInfoToolsMenu : public QMenu +{ + Q_OBJECT + +public: + explicit SpaceInfoToolsMenu(QWidget* parent, QUrl url); + virtual ~SpaceInfoToolsMenu(); +}; + +#endif diff --git a/src/statusbar/statusbarspaceinfo.cpp b/src/statusbar/statusbarspaceinfo.cpp index 046cbbb23..127641e60 100644 --- a/src/statusbar/statusbarspaceinfo.cpp +++ b/src/statusbar/statusbarspaceinfo.cpp @@ -21,6 +21,9 @@ #include "statusbarspaceinfo.h" #include "spaceinfoobserver.h" +#include "spaceinfotoolsmenu.h" + +#include #include #include @@ -65,6 +68,14 @@ void StatusBarSpaceInfo::hideEvent(QHideEvent* event) KCapacityBar::hideEvent(event); } +void StatusBarSpaceInfo::mousePressEvent(QMouseEvent* event) +{ + if (event->button() == Qt::LeftButton) { + SpaceInfoToolsMenu spaceInfoToolsMenu(this, m_url); + spaceInfoToolsMenu.exec(QCursor::pos()); + } +} + void StatusBarSpaceInfo::slotValuesChanged() { Q_ASSERT(m_observer); diff --git a/src/statusbar/statusbarspaceinfo.h b/src/statusbar/statusbarspaceinfo.h index 5d571beba..2ba7cbf0b 100644 --- a/src/statusbar/statusbarspaceinfo.h +++ b/src/statusbar/statusbarspaceinfo.h @@ -27,6 +27,7 @@ class QHideEvent; class QShowEvent; +class QMouseEvent; class SpaceInfoObserver; @@ -48,6 +49,7 @@ public: protected: void showEvent(QShowEvent* event) Q_DECL_OVERRIDE; void hideEvent(QHideEvent* event) Q_DECL_OVERRIDE; + void mousePressEvent(QMouseEvent* event) Q_DECL_OVERRIDE; private slots: void slotValuesChanged(); -- cgit v1.3.1 From fdb5c0d33e38e9d5fedc821c586bbb5ca8a0d2a5 Mon Sep 17 00:00:00 2001 From: Emmanuel Pescosta Date: Fri, 30 Jan 2015 13:08:35 +0100 Subject: Port away from KGlobalSettings::naturalSorting() by moving it to Dolphin's GeneralSettings REVIEW: 122310 --- src/CMakeLists.txt | 4 ++-- src/kitemviews/kfileitemmodel.cpp | 9 +++++---- src/settings/dolphin_generalsettings.kcfg | 6 ++++++ src/settings/general/behaviorsettingspage.cpp | 10 ++-------- src/tests/CMakeLists.txt | 18 +++++++++++++++++- 5 files changed, 32 insertions(+), 15 deletions(-) (limited to 'src/CMakeLists.txt') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d2ea49314..748b09316 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -81,7 +81,7 @@ if(HAVE_BALOO) ) endif() -kconfig_add_kcfg_files(dolphinprivate_LIB_SRCS +kconfig_add_kcfg_files(dolphinprivate_LIB_SRCS GENERATE_MOC settings/dolphin_compactmodesettings.kcfgc settings/dolphin_directoryviewpropertysettings.kcfgc settings/dolphin_detailsmodesettings.kcfgc @@ -204,7 +204,7 @@ set(dolphin_SRCS views/zoomlevelinfo.cpp ) -kconfig_add_kcfg_files(dolphin_SRCS +kconfig_add_kcfg_files(dolphin_SRCS GENERATE_MOC panels/folders/dolphin_folderspanelsettings.kcfgc panels/information/dolphin_informationpanelsettings.kcfgc panels/places/dolphin_placespanelsettings.kcfgc diff --git a/src/kitemviews/kfileitemmodel.cpp b/src/kitemviews/kfileitemmodel.cpp index 98249dbd9..019891211 100644 --- a/src/kitemviews/kfileitemmodel.cpp +++ b/src/kitemviews/kfileitemmodel.cpp @@ -21,7 +21,8 @@ #include "kfileitemmodel.h" -#include +#include "dolphin_generalsettings.h" + #include #include #include @@ -41,7 +42,7 @@ KFileItemModel::KFileItemModel(QObject* parent) : KItemModelBase("text", parent), m_dirLister(0), - m_naturalSorting(KGlobalSettings::naturalSorting()), + m_naturalSorting(GeneralSettings::naturalSorting()), m_sortDirsFirst(true), m_sortRole(NameRole), m_sortingProgressPercent(-1), @@ -106,7 +107,7 @@ KFileItemModel::KFileItemModel(QObject* parent) : m_resortAllItemsTimer->setSingleShot(true); connect(m_resortAllItemsTimer, &QTimer::timeout, this, &KFileItemModel::resortAllItems); - connect(KGlobalSettings::self(), &KGlobalSettings::naturalSortingChanged, + connect(GeneralSettings::self(), &GeneralSettings::naturalSortingChanged, this, &KFileItemModel::slotNaturalSortingChanged); } @@ -1105,7 +1106,7 @@ void KFileItemModel::slotClear() void KFileItemModel::slotNaturalSortingChanged() { - m_naturalSorting = KGlobalSettings::naturalSorting(); + m_naturalSorting = GeneralSettings::naturalSorting(); resortAllItems(); } diff --git a/src/settings/dolphin_generalsettings.kcfg b/src/settings/dolphin_generalsettings.kcfg index 3c820e28e..2f230bf51 100644 --- a/src/settings/dolphin_generalsettings.kcfg +++ b/src/settings/dolphin_generalsettings.kcfg @@ -8,6 +8,7 @@ QUrl kglobalsettings.h + @@ -92,5 +93,10 @@ true + + + true + + diff --git a/src/settings/general/behaviorsettingspage.cpp b/src/settings/general/behaviorsettingspage.cpp index 83515beb0..093a1f4e1 100644 --- a/src/settings/general/behaviorsettingspage.cpp +++ b/src/settings/general/behaviorsettingspage.cpp @@ -97,6 +97,7 @@ void BehaviorSettingsPage::applySettings() settings->setShowToolTips(m_showToolTips->isChecked()); settings->setShowSelectionToggle(m_showSelectionToggle->isChecked()); + settings->setNaturalSorting(m_naturalSorting->isChecked()); settings->setRenameInline(m_renameInline->isChecked()); settings->save(); @@ -108,13 +109,6 @@ void BehaviorSettingsPage::applySettings() ViewProperties globalProps(m_url); globalProps.setDirProperties(props); } - - const bool naturalSorting = m_naturalSorting->isChecked(); - if (KGlobalSettings::naturalSorting() != naturalSorting) { - KConfigGroup group(KSharedConfig::openConfig(), "KDE"); - group.writeEntry("NaturalSorting", naturalSorting, KConfig::Persistent | KConfig::Global); - KGlobalSettings::emitChange(KGlobalSettings::NaturalSortingChanged); - } } void BehaviorSettingsPage::restoreDefaults() @@ -133,7 +127,7 @@ void BehaviorSettingsPage::loadSettings() m_showToolTips->setChecked(GeneralSettings::showToolTips()); m_showSelectionToggle->setChecked(GeneralSettings::showSelectionToggle()); - m_naturalSorting->setChecked(KGlobalSettings::naturalSorting()); + m_naturalSorting->setChecked(GeneralSettings::naturalSorting()); m_renameInline->setChecked(GeneralSettings::renameInline()); } diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index a69400baa..fe9665d11 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -58,6 +58,10 @@ set(kitemlistcontrollertest_SRCS ../kitemviews/kstandarditemlistwidget.cpp ) +kconfig_add_kcfg_files(kitemlistcontrollertest_SRCS GENERATE_MOC + ../settings/dolphin_generalsettings.kcfgc +) + add_executable(kitemlistcontrollertest ${kitemlistcontrollertest_SRCS}) add_test(kitemlistcontrollertest kitemlistcontrollertest) ecm_mark_as_test(kitemlistcontrollertest) @@ -79,6 +83,10 @@ set(kfileitemlistviewtest_SRCS ../kitemviews/kstandarditemlistwidget.cpp ) +kconfig_add_kcfg_files(kfileitemlistviewtest_SRCS GENERATE_MOC + ../settings/dolphin_generalsettings.kcfgc +) + add_executable(kfileitemlistviewtest ${kfileitemlistviewtest_SRCS}) add_test(kfileitemlistviewtest kfileitemlistviewtest) ecm_mark_as_test(kfileitemlistviewtest) @@ -93,6 +101,10 @@ set(kfileitemmodeltest_SRCS ../kitemviews/kitemset.cpp ) +kconfig_add_kcfg_files(kfileitemmodeltest_SRCS GENERATE_MOC + ../settings/dolphin_generalsettings.kcfgc +) + add_executable(kfileitemmodeltest ${kfileitemmodeltest_SRCS}) add_test(kfileitemmodeltest kfileitemmodeltest) ecm_mark_as_test(kfileitemmodeltest) @@ -106,6 +118,10 @@ set(kfileitemmodelbenchmark_SRCS ../kitemviews/kitemmodelbase.cpp ) +kconfig_add_kcfg_files(kfileitemmodelbenchmark_SRCS GENERATE_MOC + ../settings/dolphin_generalsettings.kcfgc +) + add_executable(kfileitemmodelbenchmark ${kfileitemmodelbenchmark_SRCS}) ecm_mark_as_test(kfileitemmodelbenchmark) target_link_libraries(kfileitemmodelbenchmark dolphinprivate Qt5::Test) @@ -157,7 +173,7 @@ set(viewpropertiestest_SRCS testdir.cpp ../views/viewproperties.cpp ) -kconfig_add_kcfg_files(viewpropertiestest_SRCS +kconfig_add_kcfg_files(viewpropertiestest_SRCS GENERATE_MOC ../settings/dolphin_generalsettings.kcfgc ../settings/dolphin_directoryviewpropertysettings.kcfgc ) -- cgit v1.3.1 From c7258487094c7e16258ad90e384c3a87605dfc95 Mon Sep 17 00:00:00 2001 From: Mathieu Tarral Date: Wed, 4 Feb 2015 10:22:03 +0100 Subject: Port Dolphin away from KApplication, KCmdLineArgs and K4AboutData --- CMakeLists.txt | 2 +- src/CMakeLists.txt | 3 +- src/dolphinapplication.cpp | 102 ------------------ src/dolphinapplication.h | 44 -------- src/dolphinmainwindow.cpp | 5 +- src/dolphinmainwindow.h | 12 +-- src/main.cpp | 184 +++++++++++++++++++++------------ src/settings/dolphinsettingsdialog.cpp | 1 - 8 files changed, 128 insertions(+), 225 deletions(-) delete mode 100644 src/dolphinapplication.cpp delete mode 100644 src/dolphinapplication.h (limited to 'src/CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 43e380754..e2e93b146 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,7 +19,7 @@ ecm_setup_version(${DOLPHIN_VERSION} VARIABLE_PREFIX DOLPHINPRIVATE SOVERSION 5 ) -find_package(KF5 REQUIRED COMPONENTS DocTools Init KCMUtils KDELibs4Support NewStuff) +find_package(KF5 REQUIRED COMPONENTS DocTools Init KCMUtils KDELibs4Support NewStuff CoreAddons I18n) find_package(KF5 COMPONENTS Activities) find_package(Phonon4Qt5 CONFIG REQUIRED) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 748b09316..6ae11c833 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -147,7 +147,6 @@ install(FILES views/versioncontrol/fileviewversioncontrolplugin.desktop DESTINAT ########################################## set(dolphin_SRCS - dolphinapplication.cpp dolphindockwidget.cpp dolphinmainwindow.cpp dolphinviewcontainer.cpp @@ -236,6 +235,8 @@ target_link_libraries(kdeinit_dolphin KF5::Solid Phonon::phonon4qt5 KF5::KDELibs4Support + KF5::I18n + KF5::CoreAddons ) if (KF5Activities_FOUND) diff --git a/src/dolphinapplication.cpp b/src/dolphinapplication.cpp deleted file mode 100644 index da9358e37..000000000 --- a/src/dolphinapplication.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006-2011 by Peter Penz * - * Copyright (C) 2006 by Holger 'zecke' Freyther * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program 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 General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ - -#include "dolphinapplication.h" -#include "dolphinmainwindow.h" -#include "dolphin_generalsettings.h" - -#include -#include -#include - -DolphinApplication::DolphinApplication() : - m_mainWindow(0) -{ - m_mainWindow = new DolphinMainWindow(); - m_mainWindow->setAttribute(Qt::WA_DeleteOnClose); - - KCmdLineArgs* args = KCmdLineArgs::parsedArgs(); - - const int argsCount = args->count(); - - QList urls; - for (int i = 0; i < argsCount; ++i) { - const QUrl url = args->url(i); - if (url.isValid()) { - urls.append(url); - } - } - - bool resetSplitSettings = false; - if (args->isSet("split") && !GeneralSettings::splitView()) { - // Dolphin should be opened with a split view although this is not - // set in the GeneralSettings. Temporary adjust the setting until - // all passed URLs have been opened. - GeneralSettings::setSplitView(true); - resetSplitSettings = true; - - // We need 2 URLs to open Dolphin in split view mode - if (urls.isEmpty()) { // No URL given - Open home URL in all two views - urls.append(GeneralSettings::homeUrl()); - urls.append(GeneralSettings::homeUrl()); - } else if (urls.length() == 1) { // Only 1 URL given - Open given URL in all two views - urls.append(urls.at(0)); - } - } - - if (!urls.isEmpty()) { - if (args->isSet("select")) { - m_mainWindow->openFiles(urls); - } else { - m_mainWindow->openDirectories(urls); - } - } else { - const QUrl homeUrl(QUrl::fromLocalFile(GeneralSettings::homeUrl())); - m_mainWindow->openNewActivatedTab(homeUrl); - } - - if (resetSplitSettings) { - GeneralSettings::setSplitView(false); - } - - args->clear(); - - m_mainWindow->show(); -} - -DolphinApplication::~DolphinApplication() -{ -} - -DolphinApplication* DolphinApplication::app() -{ - return qobject_cast(qApp); -} - -void DolphinApplication::restoreSession() -{ - const QString className = KXmlGuiWindow::classNameOfToplevel(1); - if (className == QLatin1String("DolphinMainWindow")) { - m_mainWindow->restore(1); - } else { - kWarning() << "Unknown class " << className << " in session saved data!"; - } -} - diff --git a/src/dolphinapplication.h b/src/dolphinapplication.h deleted file mode 100644 index 69d07c36e..000000000 --- a/src/dolphinapplication.h +++ /dev/null @@ -1,44 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006-2011 by Peter Penz * - * Copyright (C) 2006 by Holger 'zecke' Freyther * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program 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 General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ - -#ifndef DOLPHIN_APPLICATION_H -#define DOLPHIN_APPLICATION_H - -#include - -class DolphinMainWindow; - -class DolphinApplication : public KApplication -{ - Q_OBJECT - -public: - DolphinApplication(); - virtual ~DolphinApplication(); - - static DolphinApplication* app(); - - void restoreSession(); - -private: - DolphinMainWindow* m_mainWindow; -}; - -#endif diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index 218698bef..0ee6e5c2c 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -21,7 +21,6 @@ #include "dolphinmainwindow.h" -#include "dolphinapplication.h" #include "dolphindockwidget.h" #include "dolphincontextmenu.h" #include "dolphinnewfilemenu.h" @@ -69,6 +68,7 @@ #include #include +#include #include #include #include @@ -353,8 +353,7 @@ void DolphinMainWindow::closeEvent(QCloseEvent* event) // Find out if Dolphin is closed directly by the user or // by the session manager because the session is closed bool closedByUser = true; - DolphinApplication *application = qobject_cast(qApp); - if (application && application->sessionSaving()) { + if (qApp->isSessionRestored()) { closedByUser = false; } diff --git a/src/dolphinmainwindow.h b/src/dolphinmainwindow.h index 8c8d42ee4..e3188aee5 100644 --- a/src/dolphinmainwindow.h +++ b/src/dolphinmainwindow.h @@ -36,7 +36,6 @@ typedef KIO::FileUndoManager::CommandType CommandType; class DolphinViewActionHandler; -class DolphinApplication; class DolphinSettingsDialog; class DolphinViewContainer; class DolphinRemoteEncoding; @@ -58,7 +57,6 @@ class DolphinMainWindow: public KXmlGuiWindow Q_OBJECT Q_CLASSINFO("D-Bus Interface", "org.kde.dolphin.MainWindow") Q_PROPERTY(int id READ getId SCRIPTABLE true) - friend class DolphinApplication; public: DolphinMainWindow(); @@ -121,6 +119,11 @@ public slots: /** Stores all settings and quits Dolphin. */ void quit(); + /** + * Opens a new tab showing the URL \a url and activates the tab. + */ + void openNewActivatedTab(const QUrl& url); + signals: /** * Is sent if the selection of the currently active view has @@ -335,11 +338,6 @@ private slots: */ void openNewTab(const QUrl& url); - /** - * Opens a new tab showing the URL \a url and activates the tab. - */ - void openNewActivatedTab(const QUrl& url); - /** * Opens the selected folder in a new tab. */ diff --git a/src/main.cpp b/src/main.cpp index bcd19d4d2..ed4cfff20 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,6 +1,7 @@ /*************************************************************************** * Copyright (C) 2006 by Peter Penz * * Copyright (C) 2006 by Stefan Monov * + * Copyright (C) 2015 by Mathieu Tarral * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -18,80 +19,131 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * ***************************************************************************/ -#include "dolphinapplication.h" - #include "dolphinmainwindow.h" +#include "dolphin_generalsettings.h" -#include -#include +#include +#include +#include +#include #include -#include -#include #include extern "C" Q_DECL_EXPORT int kdemain(int argc, char **argv) { - K4AboutData about("dolphin", 0, - ki18nc("@title", "Dolphin"), - "4.60", - ki18nc("@title", "File Manager"), - K4AboutData::License_GPL, - ki18nc("@info:credit", "(C) 2006-2014 Peter Penz, Frank Reininghaus, and Emmanuel Pescosta")); - about.setHomepage("http://dolphin.kde.org"); - about.addAuthor(ki18nc("@info:credit", "Emmanuel Pescosta"), - ki18nc("@info:credit", "Maintainer (since 2014) and developer"), - "emmanuelpescosta099@gmail.com"); - about.addAuthor(ki18nc("@info:credit", "Frank Reininghaus"), - ki18nc("@info:credit", "Maintainer (2012-2014) and developer"), - "frank78ac@googlemail.com"); - about.addAuthor(ki18nc("@info:credit", "Peter Penz"), - ki18nc("@info:credit", "Maintainer and developer (2006-2012)"), - "peter.penz19@gmail.com"); - about.addAuthor(ki18nc("@info:credit", "Sebastian Trüg"), - ki18nc("@info:credit", "Developer"), - "trueg@kde.org"), - about.addAuthor(ki18nc("@info:credit", "David Faure"), - ki18nc("@info:credit", "Developer"), - "faure@kde.org"); - about.addAuthor(ki18nc("@info:credit", "Aaron J. Seigo"), - ki18nc("@info:credit", "Developer"), - "aseigo@kde.org"); - about.addAuthor(ki18nc("@info:credit", "Rafael Fernández López"), - ki18nc("@info:credit", "Developer"), - "ereslibre@kde.org"); - about.addAuthor(ki18nc("@info:credit", "Kevin Ottens"), - ki18nc("@info:credit", "Developer"), - "ervin@kde.org"); - about.addAuthor(ki18nc("@info:credit", "Holger Freyther"), - ki18nc("@info:credit", "Developer"), - "freyther@gmx.net"); - about.addAuthor(ki18nc("@info:credit", "Max Blazejak"), - ki18nc("@info:credit", "Developer"), - "m43ksrocks@gmail.com"); - about.addAuthor(ki18nc("@info:credit", "Michael Austin"), - ki18nc("@info:credit", "Documentation"), - "tuxedup@users.sourceforge.net"); - // the .desktop file is not taken into account when launching manually, so - // set the icon precautionally: - about.setProgramIconName("system-file-manager"); - - KCmdLineArgs::init(argc, argv, &about); - - KCmdLineOptions options; - - options.add("select", ki18nc("@info:shell", "The files and directories passed as arguments " - "will be selected.")); - options.add("split", ki18nc("@info:shell", "Dolphin will get started with a split view.")); - options.add("+[Url]", ki18nc("@info:shell", "Document to open")); - KCmdLineArgs::addCmdLineOptions(options); - - { - DolphinApplication app; - if (app.isSessionRestored()) { - app.restoreSession(); + QApplication app(argc, argv); + app.setWindowIcon(QIcon::fromTheme("system-file-manager")); + + KAboutData aboutData("dolphin", i18n("Dolphin"), "4.60", + i18nc("@title", "File Manager"), + KAboutLicense::GPL, + i18nc("@info:credit", "(C) 2006-2014 Peter Penz, Frank Reininghaus, and Emmanuel Pescosta")); + aboutData.setHomepage("http://dolphin.kde.org"); + aboutData.addAuthor(i18nc("@info:credit", "Emmanuel Pescosta"), + i18nc("@info:credit", "Maintainer (since 2014) and developer"), + "emmanuelpescosta099@gmail.com"); + aboutData.addAuthor(i18nc("@info:credit", "Frank Reininghaus"), + i18nc("@info:credit", "Maintainer (2012-2014) and developer"), + "frank78ac@googlemail.com"); + aboutData.addAuthor(i18nc("@info:credit", "Peter Penz"), + i18nc("@info:credit", "Maintainer and developer (2006-2012)"), + "peter.penz19@gmail.com"); + aboutData.addAuthor(i18nc("@info:credit", "Sebastian Trüg"), + i18nc("@info:credit", "Developer"), + "trueg@kde.org"); + aboutData.addAuthor(i18nc("@info:credit", "David Faure"), + i18nc("@info:credit", "Developer"), + "faure@kde.org"); + aboutData.addAuthor(i18nc("@info:credit", "Aaron J. Seigo"), + i18nc("@info:credit", "Developer"), + "aseigo@kde.org"); + aboutData.addAuthor(i18nc("@info:credit", "Rafael Fernández López"), + i18nc("@info:credit", "Developer"), + "ereslibre@kde.org"); + aboutData.addAuthor(i18nc("@info:credit", "Kevin Ottens"), + i18nc("@info:credit", "Developer"), + "ervin@kde.org"); + aboutData.addAuthor(i18nc("@info:credit", "Holger Freyther"), + i18nc("@info:credit", "Developer"), + "freyther@gmx.net"); + aboutData.addAuthor(i18nc("@info:credit", "Max Blazejak"), + i18nc("@info:credit", "Developer"), + "m43ksrocks@gmail.com"); + aboutData.addAuthor(i18nc("@info:credit", "Michael Austin"), + i18nc("@info:credit", "Documentation"), + "tuxedup@users.sourceforge.net"); + + KAboutData::setApplicationData(aboutData); + + QCommandLineParser parser; + parser.addVersionOption(); + parser.addHelpOption(); + aboutData.setupCommandLine(&parser); + + // command line options + parser.addOption(QCommandLineOption(QStringList() << QLatin1String("select"), i18nc("@info:shell", "The files and directories passed as arguments " + "will be selected."))); + parser.addOption(QCommandLineOption(QStringList() << QLatin1String("split"), i18nc("@info:shell", "Dolphin will get started with a split view."))); + parser.addPositionalArgument(QLatin1String("+[Url]"), i18nc("@info:shell", "Document to open")); + + parser.process(app); + aboutData.processCommandLine(&parser); + + + DolphinMainWindow* m_mainWindow = new DolphinMainWindow(); + m_mainWindow->setAttribute(Qt::WA_DeleteOnClose); + + QList urls; + const QStringList args = parser.positionalArguments(); + foreach (const QString& str, args) { + const QUrl url(str); + if (url.isValid()) { + urls.append(url); + } + } + + bool resetSplitSettings = false; + if (parser.isSet("split") && !GeneralSettings::splitView()) { + // Dolphin should be opened with a split view although this is not + // set in the GeneralSettings. Temporary adjust the setting until + // all passed URLs have been opened. + GeneralSettings::setSplitView(true); + resetSplitSettings = true; + + // We need 2 URLs to open Dolphin in split view mode + if (urls.isEmpty()) { // No URL given - Open home URL in all two views + urls.append(GeneralSettings::homeUrl()); + urls.append(GeneralSettings::homeUrl()); + } else if (urls.length() == 1) { // Only 1 URL given - Open given URL in all two views + urls.append(urls.at(0)); + } + } + + if (!urls.isEmpty()) { + if (parser.isSet("select")) { + m_mainWindow->openFiles(urls); + } else { + m_mainWindow->openDirectories(urls); + } + } else { + const QUrl homeUrl(QUrl::fromLocalFile(GeneralSettings::homeUrl())); + m_mainWindow->openNewActivatedTab(homeUrl); + } + + if (resetSplitSettings) { + GeneralSettings::setSplitView(false); + } + + m_mainWindow->show(); + + if (app.isSessionRestored()) { + const QString className = KXmlGuiWindow::classNameOfToplevel(1); + if (className == QLatin1String("DolphinMainWindow")) { + m_mainWindow->restore(1); + } else { + kWarning() << "Unknown class " << className << " in session saved data!"; } - app.exec(); // krazy:exclude=crashy } - return 0; + return app.exec(); // krazy:exclude=crash; } diff --git a/src/settings/dolphinsettingsdialog.cpp b/src/settings/dolphinsettingsdialog.cpp index 3b72ed45c..820fc0e68 100644 --- a/src/settings/dolphinsettingsdialog.cpp +++ b/src/settings/dolphinsettingsdialog.cpp @@ -20,7 +20,6 @@ #include "dolphinsettingsdialog.h" -#include #include #include "dolphin_generalsettings.h" #include "general/generalsettingspage.h" -- cgit v1.3.1 From 1b3ea64abb0579e71ce1dfa490a0805b399be930 Mon Sep 17 00:00:00 2001 From: Emmanuel Pescosta Date: Wed, 4 Feb 2015 10:29:33 +0100 Subject: Add dolphin dbus service --- CMakeLists.txt | 2 +- src/CMakeLists.txt | 1 + src/main.cpp | 3 +++ 3 files changed, 5 insertions(+), 1 deletion(-) (limited to 'src/CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index e2e93b146..9899ed0de 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,7 +19,7 @@ ecm_setup_version(${DOLPHIN_VERSION} VARIABLE_PREFIX DOLPHINPRIVATE SOVERSION 5 ) -find_package(KF5 REQUIRED COMPONENTS DocTools Init KCMUtils KDELibs4Support NewStuff CoreAddons I18n) +find_package(KF5 REQUIRED COMPONENTS DocTools Init KCMUtils KDELibs4Support NewStuff CoreAddons I18n DBusAddons) find_package(KF5 COMPONENTS Activities) find_package(Phonon4Qt5 CONFIG REQUIRED) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6ae11c833..0c31ed936 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -237,6 +237,7 @@ target_link_libraries(kdeinit_dolphin KF5::KDELibs4Support KF5::I18n KF5::CoreAddons + KF5::DBusAddons ) if (KF5Activities_FOUND) diff --git a/src/main.cpp b/src/main.cpp index ed4cfff20..ed4c9f9d8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -22,6 +22,7 @@ #include "dolphinmainwindow.h" #include "dolphin_generalsettings.h" +#include #include #include #include @@ -75,6 +76,8 @@ extern "C" Q_DECL_EXPORT int kdemain(int argc, char **argv) KAboutData::setApplicationData(aboutData); + KDBusService dolphinDBusService; + QCommandLineParser parser; parser.addVersionOption(); parser.addHelpOption(); -- cgit v1.3.1 From db0cc8d548909c04429bc84463d2e79642ab7d76 Mon Sep 17 00:00:00 2001 From: Hrvoje Senjan Date: Wed, 4 Feb 2015 12:56:29 +0100 Subject: Try to fix the build --- src/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) (limited to 'src/CMakeLists.txt') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0c31ed936..43ffd3115 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -233,6 +233,7 @@ target_link_libraries(kdeinit_dolphin KF5::Parts KF5::KCMUtils KF5::Solid + KF5::KIOFileWidgets Phonon::phonon4qt5 KF5::KDELibs4Support KF5::I18n -- cgit v1.3.1 From 23e899577187a188e78f748a1a55883888be45db Mon Sep 17 00:00:00 2001 From: Andreas Sturmlechner Date: Thu, 22 Jan 2015 22:16:07 +0100 Subject: Make tests optional REVIEW: 122212 --- src/CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/CMakeLists.txt') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 43ffd3115..17ac9cd21 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -337,4 +337,7 @@ install( FILES settings/services/servicemenu.knsrc DESTINATION ${CONFIG_INSTALL_ install( PROGRAMS settings/services/servicemenuinstallation DESTINATION ${BIN_INSTALL_DIR} ) install( PROGRAMS settings/services/servicemenudeinstallation DESTINATION ${BIN_INSTALL_DIR} ) -add_subdirectory(tests) +if(BUILD_TESTING) + find_package(Qt5Test ${QT_MIN_VERSION} CONFIG REQUIRED) + add_subdirectory(tests) +endif() -- cgit v1.3.1 From 169cca55b9621689712321da8c0425f8002d0008 Mon Sep 17 00:00:00 2001 From: Emmanuel Pescosta Date: Tue, 24 Feb 2015 13:07:35 +0100 Subject: Replace kDebug/kWarning by categorized logging (org.kde.dolphin) --- src/CMakeLists.txt | 1 + src/dolphindebug.cpp | 22 +++++++++++ src/dolphindebug.h | 27 +++++++++++++ src/dolphinpart.cpp | 8 ++-- src/kitemviews/kfileitemmodel.cpp | 44 +++++++++++----------- src/kitemviews/kitemlistview.cpp | 8 ++-- src/kitemviews/private/kitemlistviewlayouter.cpp | 4 +- src/main.cpp | 6 +-- src/panels/folders/folderspanel.cpp | 2 +- src/panels/places/placesitem.cpp | 2 +- src/panels/places/placesitemeditdialog.cpp | 2 +- src/panels/places/placesitemmodel.cpp | 30 +++++++-------- src/panels/places/placespanel.cpp | 2 +- src/settings/serviceitemdelegate.cpp | 2 +- src/tests/kstandarditemmodeltest.cpp | 4 +- src/views/dolphinfileitemlistwidget.cpp | 2 +- src/views/dolphinremoteencoding.cpp | 8 ++-- src/views/dolphinviewactionhandler.cpp | 2 +- .../versioncontrol/versioncontrolobserver.cpp | 4 +- src/views/viewproperties.cpp | 6 +-- 20 files changed, 118 insertions(+), 68 deletions(-) create mode 100644 src/dolphindebug.cpp create mode 100644 src/dolphindebug.h (limited to 'src/CMakeLists.txt') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 17ac9cd21..4637e09d0 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -72,6 +72,7 @@ set(dolphinprivate_LIB_SRCS views/zoomlevelinfo.cpp dolphinremoveaction.cpp dolphinnewfilemenu.cpp + dolphindebug.cpp ) if(HAVE_BALOO) diff --git a/src/dolphindebug.cpp b/src/dolphindebug.cpp new file mode 100644 index 000000000..17f108427 --- /dev/null +++ b/src/dolphindebug.cpp @@ -0,0 +1,22 @@ +/*************************************************************************** + * Copyright (C) 2015 by Emmanuel Pescosta * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program 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 General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***************************************************************************/ + +#include "dolphindebug.h" + +Q_LOGGING_CATEGORY(DolphinDebug, "org.kde.dolphin") diff --git a/src/dolphindebug.h b/src/dolphindebug.h new file mode 100644 index 000000000..9b4554b49 --- /dev/null +++ b/src/dolphindebug.h @@ -0,0 +1,27 @@ +/*************************************************************************** + * Copyright (C) 2015 by Emmanuel Pescosta * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program 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 General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***************************************************************************/ + +#ifndef DOLPHIN_DEBUG_H +#define DOLPHIN_DEBUG_H + +#include + +Q_DECLARE_LOGGING_CATEGORY(DolphinDebug) + +#endif // DOLPHIN_DEBUG_H diff --git a/src/dolphinpart.cpp b/src/dolphinpart.cpp index cd1ac52b8..3473218e5 100644 --- a/src/dolphinpart.cpp +++ b/src/dolphinpart.cpp @@ -24,7 +24,7 @@ #include #include -#include +#include "dolphindebug.h" #include #include #include @@ -138,7 +138,7 @@ DolphinPart::DolphinPart(QWidget* parentWidget, QObject* parent, const QVariantL connect(lister, &KDirLister::newItems, notifyExt, &DolphinPartListingNotificationExtension::slotNewItems); connect(lister, &KDirLister::itemsDeleted, notifyExt, &DolphinPartListingNotificationExtension::slotItemsDeleted); } else { - kWarning() << "NULL KDirLister object! KParts::ListingNotificationExtension will NOT be supported"; + qCWarning(DolphinDebug) << "NULL KDirLister object! KParts::ListingNotificationExtension will NOT be supported"; } createActions(); @@ -340,7 +340,7 @@ void DolphinPart::slotMessage(const QString& msg) void DolphinPart::slotErrorMessage(const QString& msg) { - kDebug() << msg; + qCDebug(DolphinDebug) << msg; emit canceled(msg); //KMessageBox::error(m_view, msg); } @@ -471,7 +471,7 @@ void DolphinPart::slotOpenContextMenu(const QPoint& pos, void DolphinPart::slotDirectoryRedirection(const QUrl &oldUrl, const QUrl &newUrl) { - //kDebug() << oldUrl << newUrl << "currentUrl=" << url(); + //qCDebug(DolphinDebug) << oldUrl << newUrl << "currentUrl=" << url(); if (oldUrl.matches(url(), QUrl::StripTrailingSlash /* #207572 */)) { KParts::ReadOnlyPart::setUrl(newUrl); const QString prettyUrl = newUrl.toDisplayString(QUrl::PreferLocalFile); diff --git a/src/kitemviews/kfileitemmodel.cpp b/src/kitemviews/kfileitemmodel.cpp index 222a940a9..eac3ddf8b 100644 --- a/src/kitemviews/kfileitemmodel.cpp +++ b/src/kitemviews/kfileitemmodel.cpp @@ -24,7 +24,7 @@ #include "dolphin_generalsettings.h" #include -#include +#include "dolphindebug.h" #include "private/kfileitemmodelsortalgorithm.h" #include "private/kfileitemmodeldirlister.h" @@ -339,7 +339,7 @@ QList > KFileItemModel::groups() const } #ifdef KFILEITEMMODEL_DEBUG - kDebug() << "[TIME] Calculating groups for" << count() << "items:" << timer.elapsed(); + qCDebug(DolphinDebug) << "[TIME] Calculating groups for" << count() << "items:" << timer.elapsed(); #endif } @@ -408,9 +408,9 @@ int KFileItemModel::index(const QUrl& url) const if (m_items.count() != m_itemData.count() && printDebugInfo) { printDebugInfo = false; - kWarning() << "The model is in an inconsistent state."; - kWarning() << "m_items.count() ==" << m_items.count(); - kWarning() << "m_itemData.count() ==" << m_itemData.count(); + qCWarning(DolphinDebug) << "The model is in an inconsistent state."; + qCWarning(DolphinDebug) << "m_items.count() ==" << m_items.count(); + qCWarning(DolphinDebug) << "m_itemData.count() ==" << m_itemData.count(); // Check if there are multiple items with the same URL. QMultiHash indexesForUrl; @@ -420,12 +420,12 @@ int KFileItemModel::index(const QUrl& url) const foreach (const QUrl& url, indexesForUrl.uniqueKeys()) { if (indexesForUrl.count(url) > 1) { - kWarning() << "Multiple items found with the URL" << url; + qCWarning(DolphinDebug) << "Multiple items found with the URL" << url; foreach (int index, indexesForUrl.values(url)) { const ItemData* data = m_itemData.at(index); - kWarning() << "index" << index << ":" << data->item; + qCWarning(DolphinDebug) << "index" << index << ":" << data->item; if (data->parent) { - kWarning() << "parent" << data->parent->item; + qCWarning(DolphinDebug) << "parent" << data->parent->item; } } } @@ -795,8 +795,8 @@ void KFileItemModel::resortAllItems() #ifdef KFILEITEMMODEL_DEBUG QElapsedTimer timer; timer.start(); - kDebug() << "==========================================================="; - kDebug() << "Resorting" << itemCount << "items"; + qCDebug(DolphinDebug) << "==========================================================="; + qCDebug(DolphinDebug) << "Resorting" << itemCount << "items"; #endif // Remember the order of the current URLs so @@ -858,7 +858,7 @@ void KFileItemModel::resortAllItems() } #ifdef KFILEITEMMODEL_DEBUG - kDebug() << "[TIME] Resorting of" << itemCount << "items:" << timer.elapsed(); + qCDebug(DolphinDebug) << "[TIME] Resorting of" << itemCount << "items:" << timer.elapsed(); #endif } @@ -1013,7 +1013,7 @@ void KFileItemModel::slotRefreshItems(const QList >& { Q_ASSERT(!items.isEmpty()); #ifdef KFILEITEMMODEL_DEBUG - kDebug() << "Refreshing" << items.count() << "items"; + qCDebug(DolphinDebug) << "Refreshing" << items.count() << "items"; #endif // Get the indexes of all items that have been refreshed @@ -1079,7 +1079,7 @@ void KFileItemModel::slotRefreshItems(const QList >& void KFileItemModel::slotClear() { #ifdef KFILEITEMMODEL_DEBUG - kDebug() << "Clearing all items"; + qCDebug(DolphinDebug) << "Clearing all items"; #endif qDeleteAll(m_filteredItems.values()); @@ -1126,8 +1126,8 @@ void KFileItemModel::insertItems(QList& newItems) #ifdef KFILEITEMMODEL_DEBUG QElapsedTimer timer; timer.start(); - kDebug() << "==========================================================="; - kDebug() << "Inserting" << newItems.count() << "items"; + qCDebug(DolphinDebug) << "==========================================================="; + qCDebug(DolphinDebug) << "Inserting" << newItems.count() << "items"; #endif m_groups.clear(); @@ -1144,7 +1144,7 @@ void KFileItemModel::insertItems(QList& newItems) sort(newItems.begin(), newItems.end()); #ifdef KFILEITEMMODEL_DEBUG - kDebug() << "[TIME] Sorting:" << timer.elapsed(); + qCDebug(DolphinDebug) << "[TIME] Sorting:" << timer.elapsed(); #endif KItemRangeList itemRanges; @@ -1208,7 +1208,7 @@ void KFileItemModel::insertItems(QList& newItems) emit itemsInserted(itemRanges); #ifdef KFILEITEMMODEL_DEBUG - kDebug() << "[TIME] Inserting of" << newItems.count() << "items:" << timer.elapsed(); + qCDebug(DolphinDebug) << "[TIME] Inserting of" << newItems.count() << "items:" << timer.elapsed(); #endif } @@ -2213,19 +2213,19 @@ bool KFileItemModel::isConsistent() const // Check if m_items and m_itemData are consistent. const KFileItem item = fileItem(i); if (item.isNull()) { - qWarning() << "Item" << i << "is null"; + qCWarning(DolphinDebug) << "Item" << i << "is null"; return false; } const int itemIndex = index(item); if (itemIndex != i) { - qWarning() << "Item" << i << "has a wrong index:" << itemIndex; + qCWarning(DolphinDebug) << "Item" << i << "has a wrong index:" << itemIndex; return false; } // Check if the items are sorted correctly. if (i > 0 && !lessThan(m_itemData.at(i - 1), m_itemData.at(i), m_collator)) { - qWarning() << "The order of items" << i - 1 << "and" << i << "is wrong:" + qCWarning(DolphinDebug) << "The order of items" << i - 1 << "and" << i << "is wrong:" << fileItem(i - 1) << fileItem(i); return false; } @@ -2235,13 +2235,13 @@ bool KFileItemModel::isConsistent() const const ItemData* parent = data->parent; if (parent) { if (expandedParentsCount(data) != expandedParentsCount(parent) + 1) { - qWarning() << "expandedParentsCount is inconsistent for parent" << parent->item << "and child" << data->item; + qCWarning(DolphinDebug) << "expandedParentsCount is inconsistent for parent" << parent->item << "and child" << data->item; return false; } const int parentIndex = index(parent->item); if (parentIndex >= i) { - qWarning() << "Index" << parentIndex << "of parent" << parent->item << "is not smaller than index" << i << "of child" << data->item; + qCWarning(DolphinDebug) << "Index" << parentIndex << "of parent" << parent->item << "is not smaller than index" << i << "of child" << data->item; return false; } } diff --git a/src/kitemviews/kitemlistview.cpp b/src/kitemviews/kitemlistview.cpp index 0d0304afc..9416f0dd7 100644 --- a/src/kitemviews/kitemlistview.cpp +++ b/src/kitemviews/kitemlistview.cpp @@ -22,7 +22,7 @@ #include "kitemlistview.h" -#include +#include "dolphindebug.h" #include "kitemlistcontainer.h" #include "kitemlistcontroller.h" #include "kitemlistheader.h" @@ -543,7 +543,7 @@ void KItemListView::endTransaction() --m_activeTransactions; if (m_activeTransactions < 0) { m_activeTransactions = 0; - qWarning() << "Mismatch between beginTransaction()/endTransaction()"; + qCWarning(DolphinDebug) << "Mismatch between beginTransaction()/endTransaction()"; } if (m_activeTransactions == 0) { @@ -1006,7 +1006,7 @@ void KItemListView::slotItemsInserted(const KItemRangeList& itemRanges) const int index = range.index + previouslyInsertedCount; const int count = range.count; if (index < 0 || count <= 0) { - qWarning() << "Invalid item range (index:" << index << ", count:" << count << ")"; + qCWarning(DolphinDebug) << "Invalid item range (index:" << index << ", count:" << count << ")"; continue; } previouslyInsertedCount += count; @@ -1114,7 +1114,7 @@ void KItemListView::slotItemsRemoved(const KItemRangeList& itemRanges) const int index = range.index; const int count = range.count; if (index < 0 || count <= 0) { - qWarning() << "Invalid item range (index:" << index << ", count:" << count << ")"; + qCWarning(DolphinDebug) << "Invalid item range (index:" << index << ", count:" << count << ")"; continue; } diff --git a/src/kitemviews/private/kitemlistviewlayouter.cpp b/src/kitemviews/private/kitemlistviewlayouter.cpp index e2dcc62e7..d54457908 100644 --- a/src/kitemviews/private/kitemlistviewlayouter.cpp +++ b/src/kitemviews/private/kitemlistviewlayouter.cpp @@ -22,7 +22,7 @@ #include #include "kitemlistsizehintresolver.h" -#include +#include "dolphindebug.h" // #define KITEMLISTVIEWLAYOUTER_DEBUG @@ -516,7 +516,7 @@ void KItemListViewLayouter::doLayout() } #ifdef KITEMLISTVIEWLAYOUTER_DEBUG - kDebug() << "[TIME] doLayout() for " << m_model->count() << "items:" << timer.elapsed(); + qCDebug(DolphinDebug) << "[TIME] doLayout() for " << m_model->count() << "items:" << timer.elapsed(); #endif m_dirty = false; } diff --git a/src/main.cpp b/src/main.cpp index 14529005f..4291d2fa3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -28,7 +28,7 @@ #include #include #include -#include +#include "dolphindebug.h" #include extern "C" Q_DECL_EXPORT int kdemain(int argc, char **argv) @@ -109,7 +109,7 @@ extern "C" Q_DECL_EXPORT int kdemain(int argc, char **argv) if (url.isValid()) { urls.append(url); } else { - qWarning() << "Invalid URL: " << str; + qCWarning(DolphinDebug) << "Invalid URL: " << str; } } @@ -152,7 +152,7 @@ extern "C" Q_DECL_EXPORT int kdemain(int argc, char **argv) if (className == QLatin1String("DolphinMainWindow")) { m_mainWindow->restore(1); } else { - kWarning() << "Unknown class " << className << " in session saved data!"; + qCWarning(DolphinDebug) << "Unknown class " << className << " in session saved data!"; } } diff --git a/src/panels/folders/folderspanel.cpp b/src/panels/folders/folderspanel.cpp index 9169ee9e3..e99c673bc 100644 --- a/src/panels/folders/folderspanel.cpp +++ b/src/panels/folders/folderspanel.cpp @@ -49,7 +49,7 @@ #include -#include +#include "dolphindebug.h" FoldersPanel::FoldersPanel(QWidget* parent) : Panel(parent), diff --git a/src/panels/places/placesitem.cpp b/src/panels/places/placesitem.cpp index 59c2ed733..638d59ec0 100644 --- a/src/panels/places/placesitem.cpp +++ b/src/panels/places/placesitem.cpp @@ -23,7 +23,7 @@ #include "placesitem.h" #include -#include +#include "dolphindebug.h" #include #include #include "placesitemsignalhandler.h" diff --git a/src/panels/places/placesitemeditdialog.cpp b/src/panels/places/placesitemeditdialog.cpp index cd04ea3f1..d5ca4bf4f 100644 --- a/src/panels/places/placesitemeditdialog.cpp +++ b/src/panels/places/placesitemeditdialog.cpp @@ -24,7 +24,7 @@ #include "placesitemeditdialog.h" #include -#include +#include "dolphindebug.h" #include #include #include diff --git a/src/panels/places/placesitemmodel.cpp b/src/panels/places/placesitemmodel.cpp index 95a913e82..28244c645 100644 --- a/src/panels/places/placesitemmodel.cpp +++ b/src/panels/places/placesitemmodel.cpp @@ -28,7 +28,7 @@ #include #include #include -#include +#include "dolphindebug.h" #include #include #include @@ -191,7 +191,7 @@ void PlacesItemModel::setHiddenItemsShown(bool show) } #ifdef PLACESITEMMODEL_DEBUG - kDebug() << "Changed visibility of hidden items"; + qCDebug(DolphinDebug) << "Changed visibility of hidden items"; showModelState(); #endif } @@ -496,7 +496,7 @@ void PlacesItemModel::onItemInserted(int index) } #ifdef PLACESITEMMODEL_DEBUG - kDebug() << "Inserted item" << index; + qCDebug(DolphinDebug) << "Inserted item" << index; showModelState(); #endif } @@ -514,7 +514,7 @@ void PlacesItemModel::onItemRemoved(int index, KStandardItem* removedItem) m_bookmarkedItems.removeAt(boomarkIndex); #ifdef PLACESITEMMODEL_DEBUG - kDebug() << "Removed item" << index; + qCDebug(DolphinDebug) << "Removed item" << index; showModelState(); #endif } @@ -807,7 +807,7 @@ void PlacesItemModel::loadBookmarks() } #ifdef PLACESITEMMODEL_DEBUG - kDebug() << "Loaded bookmarks"; + qCDebug(DolphinDebug) << "Loaded bookmarks"; showModelState(); #endif } @@ -1176,25 +1176,25 @@ QUrl PlacesItemModel::searchUrlForType(const QString& type) #ifdef PLACESITEMMODEL_DEBUG void PlacesItemModel::showModelState() { - kDebug() << "================================="; - kDebug() << "Model:"; - kDebug() << "hidden-index model-index text"; + qCDebug(DolphinDebug) << "================================="; + qCDebug(DolphinDebug) << "Model:"; + qCDebug(DolphinDebug) << "hidden-index model-index text"; int modelIndex = 0; for (int i = 0; i < m_bookmarkedItems.count(); ++i) { if (m_bookmarkedItems[i]) { - kDebug() << i << "(Hidden) " << " " << m_bookmarkedItems[i]->dataValue("text").toString(); + qCDebug(DolphinDebug) << i << "(Hidden) " << " " << m_bookmarkedItems[i]->dataValue("text").toString(); } else { if (item(modelIndex)) { - kDebug() << i << " " << modelIndex << " " << item(modelIndex)->dataValue("text").toString(); + qCDebug(DolphinDebug) << i << " " << modelIndex << " " << item(modelIndex)->dataValue("text").toString(); } else { - kDebug() << i << " " << modelIndex << " " << "(not available yet)"; + qCDebug(DolphinDebug) << i << " " << modelIndex << " " << "(not available yet)"; } ++modelIndex; } } - kDebug(); - kDebug() << "Bookmarks:"; + qCDebug(DolphinDebug); + qCDebug(DolphinDebug) << "Bookmarks:"; int bookmarkIndex = 0; KBookmarkGroup root = m_bookmarkManager->root(); @@ -1203,9 +1203,9 @@ void PlacesItemModel::showModelState() const QString udi = bookmark.metaDataItem("UDI"); const QString text = udi.isEmpty() ? bookmark.text() : udi; if (bookmark.metaDataItem("IsHidden") == QLatin1String("true")) { - kDebug() << bookmarkIndex << "(Hidden)" << text; + qCDebug(DolphinDebug) << bookmarkIndex << "(Hidden)" << text; } else { - kDebug() << bookmarkIndex << " " << text; + qCDebug(DolphinDebug) << bookmarkIndex << " " << text; } bookmark = root.next(bookmark); diff --git a/src/panels/places/placespanel.cpp b/src/panels/places/placespanel.cpp index 5618cee21..50ed7e73a 100644 --- a/src/panels/places/placespanel.cpp +++ b/src/panels/places/placespanel.cpp @@ -26,7 +26,7 @@ #include "dolphin_generalsettings.h" #include -#include +#include "dolphindebug.h" #include #include #include diff --git a/src/settings/serviceitemdelegate.cpp b/src/settings/serviceitemdelegate.cpp index 774ea78ae..a72dd9ec8 100644 --- a/src/settings/serviceitemdelegate.cpp +++ b/src/settings/serviceitemdelegate.cpp @@ -19,7 +19,7 @@ #include "serviceitemdelegate.h" -#include +#include "dolphindebug.h" #include #include diff --git a/src/tests/kstandarditemmodeltest.cpp b/src/tests/kstandarditemmodeltest.cpp index e83e2031d..ea65cc4ce 100644 --- a/src/tests/kstandarditemmodeltest.cpp +++ b/src/tests/kstandarditemmodeltest.cpp @@ -98,13 +98,13 @@ bool KStandardItemModelTest::isModelConsistent() const for (int i = 0; i < m_model->count(); ++i) { const KStandardItem* item = m_model->item(i); if (!item) { - qWarning() << "Item" << i << "is null"; + qCWarning(DolphinDebug) << "Item" << i << "is null"; return false; } const int itemIndex = m_model->index(item); if (itemIndex != i) { - qWarning() << "Item" << i << "has a wrong index:" << itemIndex; + qCWarning(DolphinDebug) << "Item" << i << "has a wrong index:" << itemIndex; return false; } } diff --git a/src/views/dolphinfileitemlistwidget.cpp b/src/views/dolphinfileitemlistwidget.cpp index de927d91f..e8345435e 100644 --- a/src/views/dolphinfileitemlistwidget.cpp +++ b/src/views/dolphinfileitemlistwidget.cpp @@ -24,7 +24,7 @@ #include #include -#include +#include "dolphindebug.h" DolphinFileItemListWidget::DolphinFileItemListWidget(KItemListWidgetInformant* informant, QGraphicsItem* parent) : diff --git a/src/views/dolphinremoteencoding.cpp b/src/views/dolphinremoteencoding.cpp index fbf21c08f..961a7c800 100644 --- a/src/views/dolphinremoteencoding.cpp +++ b/src/views/dolphinremoteencoding.cpp @@ -26,7 +26,7 @@ #include "dolphinremoteencoding.h" #include "dolphinviewactionhandler.h" -#include +#include "dolphindebug.h" #include #include #include @@ -141,10 +141,10 @@ void DolphinRemoteEncoding::updateMenu() } } - kDebug() << "URL=" << m_currentURL << " charset=" << charset; + qCDebug(DolphinDebug) << "URL=" << m_currentURL << " charset=" << charset; if (!isFound) { - kWarning() << "could not find entry for charset=" << charset ; + qCWarning(DolphinDebug) << "could not find entry for charset=" << charset ; } else { m_menu->menu()->actions().at(id)->setChecked(true); } @@ -211,7 +211,7 @@ void DolphinRemoteEncoding::slotDefault() } for (QStringList::const_iterator it = domains.constBegin(); it != domains.constEnd();++it) { - kDebug() << "Domain to remove: " << *it; + qCDebug(DolphinDebug) << "Domain to remove: " << *it; if (config.hasGroup(*it)) { config.deleteGroup(*it); } else if (config.group("").hasKey(*it)) { diff --git a/src/views/dolphinviewactionhandler.cpp b/src/views/dolphinviewactionhandler.cpp index 4eec88ff8..ac538a648 100644 --- a/src/views/dolphinviewactionhandler.cpp +++ b/src/views/dolphinviewactionhandler.cpp @@ -39,7 +39,7 @@ #include #include -#include +#include "dolphindebug.h" #ifdef HAVE_BALOO #include diff --git a/src/views/versioncontrol/versioncontrolobserver.cpp b/src/views/versioncontrol/versioncontrolobserver.cpp index 79ba8dcc4..47e3da357 100644 --- a/src/views/versioncontrol/versioncontrolobserver.cpp +++ b/src/views/versioncontrol/versioncontrolobserver.cpp @@ -23,7 +23,7 @@ #include #include -#include +#include "dolphindebug.h" #include #include #include @@ -94,7 +94,7 @@ QList VersionControlObserver::actions(const KFileItemList& items) cons bool hasNullItems = false; foreach (const KFileItem& item, items) { if (item.isNull()) { - kWarning() << "Requesting version-control-actions for empty items"; + qCWarning(DolphinDebug) << "Requesting version-control-actions for empty items"; hasNullItems = true; break; } diff --git a/src/views/viewproperties.cpp b/src/views/viewproperties.cpp index c8d92be6d..05c993585 100644 --- a/src/views/viewproperties.cpp +++ b/src/views/viewproperties.cpp @@ -24,7 +24,7 @@ #include "dolphin_generalsettings.h" #include -#include +#include "dolphindebug.h" #include #include @@ -359,7 +359,7 @@ void ViewProperties::update() void ViewProperties::save() { - kDebug() << "Saving view-properties to" << m_filePath; + qCDebug(DolphinDebug) << "Saving view-properties to" << m_filePath; QDir dir; dir.mkpath(m_filePath); m_node->setVersion(CurrentViewPropertiesVersion); @@ -388,7 +388,7 @@ QString ViewProperties::viewModePrefix() const case DolphinView::IconsView: prefix = "Icons_"; break; case DolphinView::CompactView: prefix = "Compact_"; break; case DolphinView::DetailsView: prefix = "Details_"; break; - default: kWarning() << "Unknown view-mode of the view properties"; + default: qCWarning(DolphinDebug) << "Unknown view-mode of the view properties"; } return prefix; -- cgit v1.3.1 From f6b4f562167969365d4aae14d73060c6fdb8270f Mon Sep 17 00:00:00 2001 From: Hrvoje Senjan Date: Tue, 24 Feb 2015 17:07:55 +0100 Subject: Fix build on Jenkins (or with BUILD_TESTING=ON) --- src/CMakeLists.txt | 2 ++ src/dolphinpart.cpp | 6 +++--- src/main.cpp | 4 ++-- src/tests/CMakeLists.txt | 6 ++++++ src/tests/kstandarditemmodeltest.cpp | 2 ++ 5 files changed, 15 insertions(+), 5 deletions(-) (limited to 'src/CMakeLists.txt') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4637e09d0..ea21f1af2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -129,6 +129,7 @@ install(TARGETS dolphinprivate ${KF5_INSTALL_TARGETS_DEFAULT_ARGS}) set(dolphinpart_SRCS dolphinpart.cpp dolphinpart_ext.cpp + dolphindebug.cpp ) add_library(dolphinpart MODULE ${dolphinpart_SRCS}) @@ -202,6 +203,7 @@ set(dolphin_SRCS statusbar/spaceinfoobserver.cpp statusbar/statusbarspaceinfo.cpp views/zoomlevelinfo.cpp + dolphindebug.cpp ) kconfig_add_kcfg_files(dolphin_SRCS GENERATE_MOC diff --git a/src/dolphinpart.cpp b/src/dolphinpart.cpp index 2679ac3df..35f328be5 100644 --- a/src/dolphinpart.cpp +++ b/src/dolphinpart.cpp @@ -138,7 +138,7 @@ DolphinPart::DolphinPart(QWidget* parentWidget, QObject* parent, const QVariantL connect(lister, &KDirLister::newItems, notifyExt, &DolphinPartListingNotificationExtension::slotNewItems); connect(lister, &KDirLister::itemsDeleted, notifyExt, &DolphinPartListingNotificationExtension::slotItemsDeleted); } else { - // qCWarning(DolphinDebug) << "NULL KDirLister object! KParts::ListingNotificationExtension will NOT be supported"; + qCWarning(DolphinDebug) << "NULL KDirLister object! KParts::ListingNotificationExtension will NOT be supported"; } createActions(); @@ -340,7 +340,7 @@ void DolphinPart::slotMessage(const QString& msg) void DolphinPart::slotErrorMessage(const QString& msg) { - // qCDebug(DolphinDebug) << msg; + qCDebug(DolphinDebug) << msg; emit canceled(msg); //KMessageBox::error(m_view, msg); } @@ -471,7 +471,7 @@ void DolphinPart::slotOpenContextMenu(const QPoint& pos, void DolphinPart::slotDirectoryRedirection(const QUrl &oldUrl, const QUrl &newUrl) { - // qCDebug(DolphinDebug) << oldUrl << newUrl << "currentUrl=" << url(); + qCDebug(DolphinDebug) << oldUrl << newUrl << "currentUrl=" << url(); if (oldUrl.matches(url(), QUrl::StripTrailingSlash /* #207572 */)) { KParts::ReadOnlyPart::setUrl(newUrl); const QString prettyUrl = newUrl.toDisplayString(QUrl::PreferLocalFile); diff --git a/src/main.cpp b/src/main.cpp index 3c9dd6130..b8eb9a556 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -109,7 +109,7 @@ extern "C" Q_DECL_EXPORT int kdemain(int argc, char **argv) if (url.isValid()) { urls.append(url); } else { - // qCWarning(DolphinDebug) << "Invalid URL: " << str; + qCWarning(DolphinDebug) << "Invalid URL: " << str; } } @@ -152,7 +152,7 @@ extern "C" Q_DECL_EXPORT int kdemain(int argc, char **argv) if (className == QLatin1String("DolphinMainWindow")) { m_mainWindow->restore(1); } else { - // qCWarning(DolphinDebug) << "Unknown class " << className << " in session saved data!"; + qCWarning(DolphinDebug) << "Unknown class " << className << " in session saved data!"; } } diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index fe9665d11..1c6c5b40c 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -56,6 +56,7 @@ set(kitemlistcontrollertest_SRCS ../kitemviews/kitemset.cpp ../kitemviews/kstandarditemlistview.cpp ../kitemviews/kstandarditemlistwidget.cpp + ../dolphindebug.cpp ) kconfig_add_kcfg_files(kitemlistcontrollertest_SRCS GENERATE_MOC @@ -81,6 +82,7 @@ set(kfileitemlistviewtest_SRCS ../kitemviews/kitemset.cpp ../kitemviews/kstandarditemlistview.cpp ../kitemviews/kstandarditemlistwidget.cpp + ../dolphindebug.cpp ) kconfig_add_kcfg_files(kfileitemlistviewtest_SRCS GENERATE_MOC @@ -99,6 +101,7 @@ set(kfileitemmodeltest_SRCS ../kitemviews/kfileitemmodel.cpp ../kitemviews/kitemmodelbase.cpp ../kitemviews/kitemset.cpp + ../dolphindebug.cpp ) kconfig_add_kcfg_files(kfileitemmodeltest_SRCS GENERATE_MOC @@ -116,6 +119,7 @@ set(kfileitemmodelbenchmark_SRCS testdir.cpp ../kitemviews/kfileitemmodel.cpp ../kitemviews/kitemmodelbase.cpp + ../dolphindebug.cpp ) kconfig_add_kcfg_files(kfileitemmodelbenchmark_SRCS GENERATE_MOC @@ -160,6 +164,7 @@ set(kstandarditemmodeltest_SRCS ../kitemviews/kstandarditem.cpp ../kitemviews/kstandarditemmodel.cpp ../kitemviews/kitemmodelbase.cpp + ../dolphindebug.cpp ) add_executable(kstandarditemmodeltest ${kstandarditemmodeltest_SRCS}) @@ -172,6 +177,7 @@ set(viewpropertiestest_SRCS viewpropertiestest.cpp testdir.cpp ../views/viewproperties.cpp + ../dolphindebug.cpp ) kconfig_add_kcfg_files(viewpropertiestest_SRCS GENERATE_MOC ../settings/dolphin_generalsettings.kcfgc diff --git a/src/tests/kstandarditemmodeltest.cpp b/src/tests/kstandarditemmodeltest.cpp index ea65cc4ce..93aaf3686 100644 --- a/src/tests/kstandarditemmodeltest.cpp +++ b/src/tests/kstandarditemmodeltest.cpp @@ -18,6 +18,8 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * ***************************************************************************/ +#include "dolphindebug.h" + #include "kitemviews/kstandarditem.h" #include "kitemviews/kstandarditemmodel.h" -- cgit v1.3.1 From 25751088c33ce507096a3e25ee1eeaa7de38c76b Mon Sep 17 00:00:00 2001 From: Emmanuel Pescosta Date: Wed, 25 Feb 2015 12:12:55 +0100 Subject: Move the KVersionControlPlugin2 interface from konqlib to Dolphin and remove the deprecated KVersionControlPlugin interface from konqlib REVIEW: 122687 --- CMakeLists.txt | 42 +++- DolphinVcsConfig.cmake.in | 6 + src/CMakeLists.txt | 50 ++++- src/dolphinnewfilemenu.h | 4 +- src/dolphinremoveaction.h | 4 +- src/kitemviews/kfileitemlistview.h | 4 +- src/kitemviews/kfileitemlistwidget.h | 6 +- src/kitemviews/kfileitemmodel.h | 4 +- src/kitemviews/kfileitemmodelrolesupdater.cpp | 1 + src/kitemviews/kfileitemmodelrolesupdater.h | 4 +- src/kitemviews/kitemlistcontainer.h | 4 +- src/kitemviews/kitemlistcontroller.h | 4 +- src/kitemviews/kitemlistgroupheader.h | 4 +- src/kitemviews/kitemlistheader.h | 4 +- src/kitemviews/kitemlistselectionmanager.h | 4 +- src/kitemviews/kitemliststyleoption.h | 4 +- src/kitemviews/kitemlistview.h | 10 +- src/kitemviews/kitemlistviewaccessible.h | 8 +- src/kitemviews/kitemlistwidget.h | 6 +- src/kitemviews/kitemmodelbase.h | 4 +- src/kitemviews/kstandarditem.h | 4 +- src/kitemviews/kstandarditemlistgroupheader.h | 4 +- src/kitemviews/kstandarditemlistview.h | 4 +- src/kitemviews/kstandarditemlistwidget.h | 6 +- src/kitemviews/kstandarditemmodel.h | 4 +- src/kitemviews/private/kbaloorolesprovider.h | 4 +- src/kitemviews/private/kfileitemclipboard.h | 4 +- src/kitemviews/private/kfileitemmodeldirlister.h | 4 +- src/kitemviews/private/kfileitemmodelfilter.h | 4 +- src/kitemviews/private/kitemlistheaderwidget.h | 4 +- .../private/kitemlistkeyboardsearchmanager.h | 4 +- src/kitemviews/private/kitemlistroleeditor.h | 4 +- src/kitemviews/private/kitemlistrubberband.h | 4 +- src/kitemviews/private/kitemlistselectiontoggle.h | 4 +- src/kitemviews/private/kitemlistsizehintresolver.h | 4 +- src/kitemviews/private/kitemlistsmoothscroller.h | 4 +- src/kitemviews/private/kitemlistviewanimation.h | 4 +- src/kitemviews/private/kitemlistviewlayouter.h | 4 +- src/kitemviews/private/kpixmapmodifier.h | 4 +- src/settings/viewpropertiesdialog.h | 4 +- src/tests/CMakeLists.txt | 2 +- src/views/dolphinfileitemlistwidget.cpp | 29 ++- src/views/dolphinfileitemlistwidget.h | 8 +- src/views/dolphinitemlistview.h | 4 +- src/views/dolphinnewfilemenuobserver.h | 4 +- src/views/dolphinremoteencoding.h | 4 +- src/views/dolphinview.h | 4 +- src/views/dolphinviewactionhandler.h | 4 +- src/views/draganddrophelper.h | 4 +- src/views/renamedialog.h | 4 +- src/views/versioncontrol/kversioncontrolplugin.cpp | 29 +++ src/views/versioncontrol/kversioncontrolplugin.h | 223 +++++++++++++++++++++ .../versioncontrol/updateitemstatesthread.cpp | 20 +- src/views/versioncontrol/updateitemstatesthread.h | 6 +- .../versioncontrol/versioncontrolobserver.cpp | 41 +--- src/views/versioncontrol/versioncontrolobserver.h | 10 +- src/views/viewmodecontroller.h | 4 +- src/views/viewproperties.h | 4 +- 58 files changed, 469 insertions(+), 194 deletions(-) create mode 100644 DolphinVcsConfig.cmake.in create mode 100644 src/views/versioncontrol/kversioncontrolplugin.cpp create mode 100644 src/views/versioncontrol/kversioncontrolplugin.h (limited to 'src/CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 570910497..3a3ab6d4c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,18 +3,25 @@ cmake_minimum_required(VERSION 2.8.12) project(Dolphin) # ECM setup -find_package(ECM 1.2.0 CONFIG REQUIRED) +find_package(ECM 1.6.0 CONFIG REQUIRED) set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH}) set(DOLPHIN_VERSION "4.97.0") include(ECMSetupVersion) +include(ECMGenerateHeaders) include(GenerateExportHeader) include(FeatureSummary) include(KDEInstallDirs) include(KDECMakeSettings) include(KDEFrameworkCompilerSettings) +ecm_setup_version(${DOLPHIN_VERSION} VARIABLE_PREFIX DOLPHINVCS + VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/dolphinvcs_version.h" + PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/DolphinVcsConfigVersion.cmake" + SOVERSION 5 +) + ecm_setup_version(${DOLPHIN_VERSION} VARIABLE_PREFIX DOLPHINPRIVATE SOVERSION 5 ) @@ -24,12 +31,6 @@ find_package(KF5 COMPONENTS Activities) find_package(Phonon4Qt5 CONFIG REQUIRED) -if ("${CMAKE_SOURCE_DIR}" STREQUAL "${Dolphin_SOURCE_DIR}") - find_package(KF5Konq CONFIG REQUIRED) -else() - include_directories(${LibKonq_SOURCE_DIR}/src) -endif() - find_package(KF5Baloo 4.97) set_package_properties(KF5Baloo PROPERTIES DESCRIPTION "Baloo Core libraries" URL "http://www.kde.org" @@ -58,6 +59,33 @@ endif() add_subdirectory(src) add_subdirectory(docs) +# CMake files +set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/Dolphin") + +ecm_configure_package_config_file( + "${CMAKE_CURRENT_SOURCE_DIR}/DolphinVcsConfig.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/DolphinVcsConfig.cmake" + INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR} +) + +install(FILES + "${CMAKE_CURRENT_BINARY_DIR}/DolphinVcsConfig.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/DolphinVcsConfigVersion.cmake" + DESTINATION "${CMAKECONFIG_INSTALL_DIR}" + COMPONENT Devel +) + +install(EXPORT DolphinVcsTargets + DESTINATION "${CMAKECONFIG_INSTALL_DIR}" + FILE DolphinVcsTargets.cmake +) + +install(FILES + "${CMAKE_CURRENT_BINARY_DIR}/dolphinvcs_version.h" + DESTINATION "${KDE_INSTALL_INCLUDEDIR}/Dolphin" + COMPONENT Devel +) + # TODO Remove the if/endif lines if Dolphin is split. if ("${CMAKE_SOURCE_DIR}" STREQUAL "${Dolphin_SOURCE_DIR}") feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) diff --git a/DolphinVcsConfig.cmake.in b/DolphinVcsConfig.cmake.in new file mode 100644 index 000000000..7e7a2296f --- /dev/null +++ b/DolphinVcsConfig.cmake.in @@ -0,0 +1,6 @@ +@PACKAGE_INIT@ + +find_dependency(Qt5Widgets) +find_dependency(KF5KIO) + +include("${CMAKE_CURRENT_LIST_DIR}/DolphinVcsTargets.cmake") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ea21f1af2..2b65671da 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -12,6 +12,42 @@ endif() configure_file(config-X11.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-X11.h) +########################################## + +set(dolphinvcs_LIB_SRCS + views/versioncontrol/kversioncontrolplugin.cpp +) + +add_library(dolphinvcs ${dolphinvcs_LIB_SRCS}) + +generate_export_header(dolphinvcs BASE_NAME dolphin) + +target_link_libraries( + dolphinvcs PUBLIC + Qt5::Widgets + KF5::KIOCore +) + +set_target_properties(dolphinvcs PROPERTIES + VERSION ${DOLPHINVCS_VERSION_STRING} + SOVERSION ${DOLPHINVCS_SOVERSION} + EXPORT_NAME DolphinVcs +) + +ecm_generate_headers(dolphinvcs_LIB_HEADERS + HEADER_NAMES + KVersionControlPlugin + + RELATIVE "views/versioncontrol" + REQUIRED_HEADERS dolphinvcs_LIB_HEADERS +) + +install(TARGETS dolphinvcs EXPORT DolphinVcsTargets ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) + +install(FILES views/versioncontrol/fileviewversioncontrolplugin.desktop DESTINATION ${KDE_INSTALL_KSERVICETYPES5DIR}) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/dolphin_export.h DESTINATION ${KDE_INSTALL_INCLUDEDIR} COMPONENT Devel) +install(FILES ${dolphinvcs_LIB_HEADERS} DESTINATION "${KDE_INSTALL_INCLUDEDIR}/Dolphin" COMPONENT Devel) + ########### next target ############### set(dolphinprivate_LIB_SRCS @@ -93,13 +129,10 @@ kconfig_add_kcfg_files(dolphinprivate_LIB_SRCS GENERATE_MOC add_library(dolphinprivate ${dolphinprivate_LIB_SRCS}) -generate_export_header(dolphinprivate BASE_NAME libdolphinprivate - EXPORT_FILE_NAME libdolphin_export.h) - target_link_libraries( dolphinprivate PUBLIC + dolphinvcs KF5::KDELibs4Support - KF5::Konq KF5::NewStuff ) @@ -122,7 +155,7 @@ set_target_properties(dolphinprivate PROPERTIES SOVERSION ${DOLPHINPRIVATE_SOVERSION} ) -install(TARGETS dolphinprivate ${KF5_INSTALL_TARGETS_DEFAULT_ARGS}) +install(TARGETS dolphinprivate ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) ########################################## @@ -136,7 +169,6 @@ add_library(dolphinpart MODULE ${dolphinpart_SRCS}) target_link_libraries(dolphinpart dolphinprivate - KF5::Konq KF5::KDELibs4Support ) @@ -144,7 +176,6 @@ install(TARGETS dolphinpart DESTINATION ${PLUGIN_INSTALL_DIR}) install(FILES dolphinpart.rc DESTINATION ${CMAKE_INSTALL_KXMLGUI5DIR}/dolphinpart) install(FILES dolphinpart.desktop DESTINATION ${SERVICES_INSTALL_DIR}) -install(FILES views/versioncontrol/fileviewversioncontrolplugin.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR}) ########################################## @@ -230,7 +261,6 @@ kf5_add_kdeinit_executable(dolphin ${dolphin_SRCS}) target_include_directories(kdeinit_dolphin PRIVATE ${PHONON_INCLUDES}) target_link_libraries(kdeinit_dolphin - KF5::Konq dolphinprivate KF5::NewStuff KF5::Parts @@ -251,8 +281,8 @@ if (KF5Activities_FOUND) ) endif() -install(TARGETS kdeinit_dolphin ${KF5_INSTALL_TARGETS_DEFAULT_ARGS}) -install(TARGETS dolphin ${KF5_INSTALL_TARGETS_DEFAULT_ARGS}) +install(TARGETS kdeinit_dolphin ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) +install(TARGETS dolphin ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) ########################################## diff --git a/src/dolphinnewfilemenu.h b/src/dolphinnewfilemenu.h index 254571eb9..9f1cb5599 100644 --- a/src/dolphinnewfilemenu.h +++ b/src/dolphinnewfilemenu.h @@ -23,7 +23,7 @@ #include -#include "libdolphin_export.h" +#include "dolphin_export.h" class KJob; @@ -35,7 +35,7 @@ class KJob; * All errors are shown in the status bar of Dolphin * instead as modal error dialog with an OK button. */ -class LIBDOLPHINPRIVATE_EXPORT DolphinNewFileMenu : public KNewFileMenu +class DOLPHIN_EXPORT DolphinNewFileMenu : public KNewFileMenu { Q_OBJECT diff --git a/src/dolphinremoveaction.h b/src/dolphinremoveaction.h index 1a123ace5..85f404318 100644 --- a/src/dolphinremoveaction.h +++ b/src/dolphinremoveaction.h @@ -20,7 +20,7 @@ #ifndef DOLPHINREMOVEACTION_H #define DOLPHINREMOVEACTION_H -#include "libdolphin_export.h" +#include "dolphin_export.h" #include #include @@ -34,7 +34,7 @@ * This class expects the presence of both the "move_to_trash" and "delete" * actions in @ref collection. */ -class LIBDOLPHINPRIVATE_EXPORT DolphinRemoveAction : public QAction +class DOLPHIN_EXPORT DolphinRemoveAction : public QAction { Q_OBJECT public: diff --git a/src/kitemviews/kfileitemlistview.h b/src/kitemviews/kfileitemlistview.h index 72688893e..84aa17d89 100644 --- a/src/kitemviews/kfileitemlistview.h +++ b/src/kitemviews/kfileitemlistview.h @@ -20,7 +20,7 @@ #ifndef KFILEITEMLISTVIEW_H #define KFILEITEMLISTVIEW_H -#include "libdolphin_export.h" +#include "dolphin_export.h" #include @@ -36,7 +36,7 @@ class QTimer; * KItemListView::setWidgetCreator() and KItemListView::setGroupHeaderCreator() * to apply customized generators. */ -class LIBDOLPHINPRIVATE_EXPORT KFileItemListView : public KStandardItemListView +class DOLPHIN_EXPORT KFileItemListView : public KStandardItemListView { Q_OBJECT diff --git a/src/kitemviews/kfileitemlistwidget.h b/src/kitemviews/kfileitemlistwidget.h index 32959e4f6..07ca59b44 100644 --- a/src/kitemviews/kfileitemlistwidget.h +++ b/src/kitemviews/kfileitemlistwidget.h @@ -20,11 +20,11 @@ #ifndef KFILEITEMLISTWIDGET_H #define KFILEITEMLISTWIDGET_H -#include "libdolphin_export.h" +#include "dolphin_export.h" #include -class LIBDOLPHINPRIVATE_EXPORT KFileItemListWidgetInformant : public KStandardItemListWidgetInformant +class DOLPHIN_EXPORT KFileItemListWidgetInformant : public KStandardItemListWidgetInformant { public: KFileItemListWidgetInformant(); @@ -37,7 +37,7 @@ protected: virtual QFont customizedFontForLinks(const QFont& baseFont) const Q_DECL_OVERRIDE; }; -class LIBDOLPHINPRIVATE_EXPORT KFileItemListWidget : public KStandardItemListWidget +class DOLPHIN_EXPORT KFileItemListWidget : public KStandardItemListWidget { Q_OBJECT diff --git a/src/kitemviews/kfileitemmodel.h b/src/kitemviews/kfileitemmodel.h index 8e36294e9..167f508cf 100644 --- a/src/kitemviews/kfileitemmodel.h +++ b/src/kitemviews/kfileitemmodel.h @@ -20,7 +20,7 @@ #ifndef KFILEITEMMODEL_H #define KFILEITEMMODEL_H -#include "libdolphin_export.h" +#include "dolphin_export.h" #include #include #include @@ -43,7 +43,7 @@ class QTimer; * Recursive expansion of sub-directories is supported by * KFileItemModel::setExpanded(). */ -class LIBDOLPHINPRIVATE_EXPORT KFileItemModel : public KItemModelBase +class DOLPHIN_EXPORT KFileItemModel : public KItemModelBase { Q_OBJECT diff --git a/src/kitemviews/kfileitemmodelrolesupdater.cpp b/src/kitemviews/kfileitemmodelrolesupdater.cpp index f17a77e0a..c18d65892 100644 --- a/src/kitemviews/kfileitemmodelrolesupdater.cpp +++ b/src/kitemviews/kfileitemmodelrolesupdater.cpp @@ -23,6 +23,7 @@ #include #include +#include #include #include #include diff --git a/src/kitemviews/kfileitemmodelrolesupdater.h b/src/kitemviews/kfileitemmodelrolesupdater.h index 6c82dbe4a..216b0a501 100644 --- a/src/kitemviews/kfileitemmodelrolesupdater.h +++ b/src/kitemviews/kfileitemmodelrolesupdater.h @@ -25,7 +25,7 @@ #include #include -#include "libdolphin_export.h" +#include "dolphin_export.h" #include #include @@ -87,7 +87,7 @@ namespace KIO { * 3. Finally, the entire process is repeated for any items that might have * changed in the mean time. */ -class LIBDOLPHINPRIVATE_EXPORT KFileItemModelRolesUpdater : public QObject +class DOLPHIN_EXPORT KFileItemModelRolesUpdater : public QObject { Q_OBJECT diff --git a/src/kitemviews/kitemlistcontainer.h b/src/kitemviews/kitemlistcontainer.h index 6f2851b3e..9fc3d4957 100644 --- a/src/kitemviews/kitemlistcontainer.h +++ b/src/kitemviews/kitemlistcontainer.h @@ -23,7 +23,7 @@ #ifndef KITEMLISTCONTAINER_H #define KITEMLISTCONTAINER_H -#include "libdolphin_export.h" +#include "dolphin_export.h" #include @@ -39,7 +39,7 @@ class KItemModelBase; * * @see KItemListController */ -class LIBDOLPHINPRIVATE_EXPORT KItemListContainer : public QAbstractScrollArea +class DOLPHIN_EXPORT KItemListContainer : public QAbstractScrollArea { Q_OBJECT diff --git a/src/kitemviews/kitemlistcontroller.h b/src/kitemviews/kitemlistcontroller.h index 2824a1fc9..b8a93edac 100644 --- a/src/kitemviews/kitemlistcontroller.h +++ b/src/kitemviews/kitemlistcontroller.h @@ -23,7 +23,7 @@ #ifndef KITEMLISTCONTROLLER_H #define KITEMLISTCONTROLLER_H -#include "libdolphin_export.h" +#include "dolphin_export.h" #include "kitemset.h" @@ -56,7 +56,7 @@ class QTransform; * @see KItemModelBase * @see KItemListSelectionManager */ -class LIBDOLPHINPRIVATE_EXPORT KItemListController : public QObject +class DOLPHIN_EXPORT KItemListController : public QObject { Q_OBJECT Q_ENUMS(SelectionBehavior) diff --git a/src/kitemviews/kitemlistgroupheader.h b/src/kitemviews/kitemlistgroupheader.h index c89da5027..4612bc4da 100644 --- a/src/kitemviews/kitemlistgroupheader.h +++ b/src/kitemviews/kitemlistgroupheader.h @@ -20,7 +20,7 @@ #ifndef KITEMLISTGROUPHEADER_H #define KITEMLISTGROUPHEADER_H -#include "libdolphin_export.h" +#include "dolphin_export.h" #include @@ -37,7 +37,7 @@ class KItemListView; * the method paint() and draw the role within the given roleBounds() with * the color roleColor(). */ -class LIBDOLPHINPRIVATE_EXPORT KItemListGroupHeader : public QGraphicsWidget +class DOLPHIN_EXPORT KItemListGroupHeader : public QGraphicsWidget { Q_OBJECT diff --git a/src/kitemviews/kitemlistheader.h b/src/kitemviews/kitemlistheader.h index b361b912b..cc2b74793 100644 --- a/src/kitemviews/kitemlistheader.h +++ b/src/kitemviews/kitemlistheader.h @@ -20,7 +20,7 @@ #ifndef KITEMLISTHEADER_H #define KITEMLISTHEADER_H -#include "libdolphin_export.h" +#include "dolphin_export.h" #include #include @@ -33,7 +33,7 @@ class KItemListView; * Each column of the header represents a visible role * accessible by KItemListView::visibleRoles(). */ -class LIBDOLPHINPRIVATE_EXPORT KItemListHeader : public QObject +class DOLPHIN_EXPORT KItemListHeader : public QObject { Q_OBJECT diff --git a/src/kitemviews/kitemlistselectionmanager.h b/src/kitemviews/kitemlistselectionmanager.h index a8318388c..16761428b 100644 --- a/src/kitemviews/kitemlistselectionmanager.h +++ b/src/kitemviews/kitemlistselectionmanager.h @@ -23,7 +23,7 @@ #ifndef KITEMLISTSELECTIONMANAGER_H #define KITEMLISTSELECTIONMANAGER_H -#include "libdolphin_export.h" +#include "dolphin_export.h" #include #include @@ -35,7 +35,7 @@ class KItemModelBase; /** * @brief Allows to select and deselect items of a KItemListView. */ -class LIBDOLPHINPRIVATE_EXPORT KItemListSelectionManager : public QObject +class DOLPHIN_EXPORT KItemListSelectionManager : public QObject { Q_OBJECT diff --git a/src/kitemviews/kitemliststyleoption.h b/src/kitemviews/kitemliststyleoption.h index 9290dc341..09b787c27 100644 --- a/src/kitemviews/kitemliststyleoption.h +++ b/src/kitemviews/kitemliststyleoption.h @@ -20,14 +20,14 @@ #ifndef KITEMLISTSTYLEOPTION_H #define KITEMLISTSTYLEOPTION_H -#include "libdolphin_export.h" +#include "dolphin_export.h" #include #include #include #include -class LIBDOLPHINPRIVATE_EXPORT KItemListStyleOption +class DOLPHIN_EXPORT KItemListStyleOption { public: KItemListStyleOption(); diff --git a/src/kitemviews/kitemlistview.h b/src/kitemviews/kitemlistview.h index 8130e45ed..f20180289 100644 --- a/src/kitemviews/kitemlistview.h +++ b/src/kitemviews/kitemlistview.h @@ -23,7 +23,7 @@ #ifndef KITEMLISTVIEW_H #define KITEMLISTVIEW_H -#include "libdolphin_export.h" +#include "dolphin_export.h" #include #include @@ -59,7 +59,7 @@ class QTimer; * @see KItemListWidget * @see KItemModelBase */ -class LIBDOLPHINPRIVATE_EXPORT KItemListView : public QGraphicsWidget +class DOLPHIN_EXPORT KItemListView : public QGraphicsWidget { Q_OBJECT @@ -769,7 +769,7 @@ private: * KItemListWidgetCreatorBase and KItemListGroupHeaderCreatorBase. * @internal */ -class LIBDOLPHINPRIVATE_EXPORT KItemListCreatorBase +class DOLPHIN_EXPORT KItemListCreatorBase { public: virtual ~KItemListCreatorBase(); @@ -793,7 +793,7 @@ private: * expensive instantiations and deletions of KItemListWidgets by recycling existing widget * instances. */ -class LIBDOLPHINPRIVATE_EXPORT KItemListWidgetCreatorBase : public KItemListCreatorBase +class DOLPHIN_EXPORT KItemListWidgetCreatorBase : public KItemListCreatorBase { public: virtual ~KItemListWidgetCreatorBase(); @@ -875,7 +875,7 @@ qreal KItemListWidgetCreator::preferredRoleColumnWidth(const QByteArray& role * The intention of the group-header creator is to prevent repetitive and expensive instantiations and * deletions of KItemListGroupHeaders by recycling existing header instances. */ -class LIBDOLPHINPRIVATE_EXPORT KItemListGroupHeaderCreatorBase : public KItemListCreatorBase +class DOLPHIN_EXPORT KItemListGroupHeaderCreatorBase : public KItemListCreatorBase { public: virtual ~KItemListGroupHeaderCreatorBase(); diff --git a/src/kitemviews/kitemlistviewaccessible.h b/src/kitemviews/kitemlistviewaccessible.h index 28b0be4e6..afef2d5fe 100644 --- a/src/kitemviews/kitemlistviewaccessible.h +++ b/src/kitemviews/kitemlistviewaccessible.h @@ -22,7 +22,7 @@ #ifndef QT_NO_ACCESSIBILITY -#include "libdolphin_export.h" +#include "dolphin_export.h" #include #include @@ -32,7 +32,7 @@ class KItemListView; class KItemListContainer; -class LIBDOLPHINPRIVATE_EXPORT KItemListViewAccessible: public QAccessibleObject, public QAccessibleTableInterface +class DOLPHIN_EXPORT KItemListViewAccessible: public QAccessibleObject, public QAccessibleTableInterface { public: explicit KItemListViewAccessible(KItemListView* view); @@ -89,7 +89,7 @@ private: mutable QVector m_cells; }; -class LIBDOLPHINPRIVATE_EXPORT KItemListAccessibleCell: public QAccessibleInterface, public QAccessibleTableCellInterface +class DOLPHIN_EXPORT KItemListAccessibleCell: public QAccessibleInterface, public QAccessibleTableCellInterface { public: KItemListAccessibleCell(KItemListView* view, int m_index); @@ -128,7 +128,7 @@ private: int m_index; }; -class LIBDOLPHINPRIVATE_EXPORT KItemListContainerAccessible : public QAccessibleWidget +class DOLPHIN_EXPORT KItemListContainerAccessible : public QAccessibleWidget { public: explicit KItemListContainerAccessible(KItemListContainer* container); diff --git a/src/kitemviews/kitemlistwidget.h b/src/kitemviews/kitemlistwidget.h index 723847c43..ae99a1f29 100644 --- a/src/kitemviews/kitemlistwidget.h +++ b/src/kitemviews/kitemlistwidget.h @@ -23,7 +23,7 @@ #ifndef KITEMLISTWIDGET_H #define KITEMLISTWIDGET_H -#include "libdolphin_export.h" +#include "dolphin_export.h" #include @@ -43,7 +43,7 @@ class QPropertyAnimation; * size for the invisible items must be accessible. KItemListWidgetInformant * provides this information. */ -class LIBDOLPHINPRIVATE_EXPORT KItemListWidgetInformant +class DOLPHIN_EXPORT KItemListWidgetInformant { public: KItemListWidgetInformant(); @@ -63,7 +63,7 @@ public: * All properties are set by KItemListView, for each property there is a corresponding * virtual protected method that allows to react on property changes. */ -class LIBDOLPHINPRIVATE_EXPORT KItemListWidget : public QGraphicsWidget +class DOLPHIN_EXPORT KItemListWidget : public QGraphicsWidget { Q_OBJECT diff --git a/src/kitemviews/kitemmodelbase.h b/src/kitemviews/kitemmodelbase.h index e46d761fc..bd5ca1d65 100644 --- a/src/kitemviews/kitemmodelbase.h +++ b/src/kitemviews/kitemmodelbase.h @@ -23,7 +23,7 @@ #ifndef KITEMMODELBASE_H #define KITEMMODELBASE_H -#include "libdolphin_export.h" +#include "dolphin_export.h" #include #include @@ -49,7 +49,7 @@ class QMimeData; * Also optionally it is possible to provide a tree of items by implementing the methods * setExpanded(), isExpanded(), isExpandable() and expandedParentsCount(). */ -class LIBDOLPHINPRIVATE_EXPORT KItemModelBase : public QObject +class DOLPHIN_EXPORT KItemModelBase : public QObject { Q_OBJECT diff --git a/src/kitemviews/kstandarditem.h b/src/kitemviews/kstandarditem.h index b1d5edf2e..5bb2bb36f 100644 --- a/src/kitemviews/kstandarditem.h +++ b/src/kitemviews/kstandarditem.h @@ -20,7 +20,7 @@ #ifndef KSTANDARDITEM_H #define KSTANDARDITEM_H -#include "libdolphin_export.h" +#include "dolphin_export.h" #include #include @@ -36,7 +36,7 @@ class KStandardItemModel; * used roles. It is possible to assign values for custom * roles by using setDataValue(). */ -class LIBDOLPHINPRIVATE_EXPORT KStandardItem +class DOLPHIN_EXPORT KStandardItem { public: diff --git a/src/kitemviews/kstandarditemlistgroupheader.h b/src/kitemviews/kstandarditemlistgroupheader.h index caf906ddf..f0eacfd49 100644 --- a/src/kitemviews/kstandarditemlistgroupheader.h +++ b/src/kitemviews/kstandarditemlistgroupheader.h @@ -20,14 +20,14 @@ #ifndef KSTANDARDITEMLISTGROUPHEADER_H #define KSTANDARDITEMLISTGROUPHEADER_H -#include "libdolphin_export.h" +#include "dolphin_export.h" #include #include #include -class LIBDOLPHINPRIVATE_EXPORT KStandardItemListGroupHeader : public KItemListGroupHeader +class DOLPHIN_EXPORT KStandardItemListGroupHeader : public KItemListGroupHeader { Q_OBJECT diff --git a/src/kitemviews/kstandarditemlistview.h b/src/kitemviews/kstandarditemlistview.h index 9fc43a940..2e4c7a0a0 100644 --- a/src/kitemviews/kstandarditemlistview.h +++ b/src/kitemviews/kstandarditemlistview.h @@ -20,7 +20,7 @@ #ifndef KSTANDARDITEMLISTVIEW_H #define KSTANDARDITEMLISTVIEW_H -#include "libdolphin_export.h" +#include "dolphin_export.h" #include @@ -40,7 +40,7 @@ * KItemListContainer* container = new KItemListContainer(controller, parentWidget); * */ -class LIBDOLPHINPRIVATE_EXPORT KStandardItemListView : public KItemListView +class DOLPHIN_EXPORT KStandardItemListView : public KItemListView { Q_OBJECT diff --git a/src/kitemviews/kstandarditemlistwidget.h b/src/kitemviews/kstandarditemlistwidget.h index 8e61d06b4..826452255 100644 --- a/src/kitemviews/kstandarditemlistwidget.h +++ b/src/kitemviews/kstandarditemlistwidget.h @@ -20,7 +20,7 @@ #ifndef KSTANDARDITEMLISTWIDGET_H #define KSTANDARDITEMLISTWIDGET_H -#include "libdolphin_export.h" +#include "dolphin_export.h" #include @@ -32,7 +32,7 @@ class KItemListRoleEditor; class KItemListStyleOption; class KItemListView; -class LIBDOLPHINPRIVATE_EXPORT KStandardItemListWidgetInformant : public KItemListWidgetInformant +class DOLPHIN_EXPORT KStandardItemListWidgetInformant : public KItemListWidgetInformant { public: KStandardItemListWidgetInformant(); @@ -83,7 +83,7 @@ protected: /** * @brief Itemlist widget implementation for KStandardItemView and KStandardItemModel. */ -class LIBDOLPHINPRIVATE_EXPORT KStandardItemListWidget : public KItemListWidget +class DOLPHIN_EXPORT KStandardItemListWidget : public KItemListWidget { Q_OBJECT diff --git a/src/kitemviews/kstandarditemmodel.h b/src/kitemviews/kstandarditemmodel.h index 3b5f5bd39..58c5a5d88 100644 --- a/src/kitemviews/kstandarditemmodel.h +++ b/src/kitemviews/kstandarditemmodel.h @@ -20,7 +20,7 @@ #ifndef KSTANDARDITEMMODEL_H #define KSTANDARDITEMMODEL_H -#include "libdolphin_export.h" +#include "dolphin_export.h" #include #include #include @@ -35,7 +35,7 @@ class KStandardItem; * * @see KStandardItem */ -class LIBDOLPHINPRIVATE_EXPORT KStandardItemModel : public KItemModelBase +class DOLPHIN_EXPORT KStandardItemModel : public KItemModelBase { Q_OBJECT diff --git a/src/kitemviews/private/kbaloorolesprovider.h b/src/kitemviews/private/kbaloorolesprovider.h index ef073a367..9673bff4f 100644 --- a/src/kitemviews/private/kbaloorolesprovider.h +++ b/src/kitemviews/private/kbaloorolesprovider.h @@ -21,7 +21,7 @@ #ifndef KBALOO_ROLESPROVIDER_H #define KBALOO_ROLESPROVIDER_H -#include "libdolphin_export.h" +#include "dolphin_export.h" #include #include @@ -36,7 +36,7 @@ namespace Baloo { * Is a helper class for KFileItemModelRolesUpdater to retrieve roles that * are only accessible with Baloo. */ -class LIBDOLPHINPRIVATE_EXPORT KBalooRolesProvider +class DOLPHIN_EXPORT KBalooRolesProvider { public: static KBalooRolesProvider& instance(); diff --git a/src/kitemviews/private/kfileitemclipboard.h b/src/kitemviews/private/kfileitemclipboard.h index d02fc0d47..3ee50d661 100644 --- a/src/kitemviews/private/kfileitemclipboard.h +++ b/src/kitemviews/private/kfileitemclipboard.h @@ -25,13 +25,13 @@ #include #include -#include "libdolphin_export.h" +#include "dolphin_export.h" /** * @brief Wrapper for QClipboard to provide fast access for checking * whether a KFileItem has been clipped. */ -class LIBDOLPHINPRIVATE_EXPORT KFileItemClipboard : public QObject +class DOLPHIN_EXPORT KFileItemClipboard : public QObject { Q_OBJECT diff --git a/src/kitemviews/private/kfileitemmodeldirlister.h b/src/kitemviews/private/kfileitemmodeldirlister.h index a9c8c845a..c2c621aed 100644 --- a/src/kitemviews/private/kfileitemmodeldirlister.h +++ b/src/kitemviews/private/kfileitemmodeldirlister.h @@ -20,7 +20,7 @@ #ifndef KFILEITEMMODELDIRLISTER_H #define KFILEITEMMODELDIRLISTER_H -#include "libdolphin_export.h" +#include "dolphin_export.h" #include #include @@ -29,7 +29,7 @@ * error occurred instead of showing an error dialog. * KDirLister::autoErrorHandlingEnabled() is set to false. */ -class LIBDOLPHINPRIVATE_EXPORT KFileItemModelDirLister : public KDirLister +class DOLPHIN_EXPORT KFileItemModelDirLister : public KDirLister { Q_OBJECT diff --git a/src/kitemviews/private/kfileitemmodelfilter.h b/src/kitemviews/private/kfileitemmodelfilter.h index b26e31a00..67c1c280c 100644 --- a/src/kitemviews/private/kfileitemmodelfilter.h +++ b/src/kitemviews/private/kfileitemmodelfilter.h @@ -21,7 +21,7 @@ #ifndef KFILEITEMMODELFILTER_H #define KFILEITEMMODELFILTER_H -#include "libdolphin_export.h" +#include "dolphin_export.h" #include class KFileItem; @@ -35,7 +35,7 @@ class QRegExp; * property of the KFileItem, but this might get extended in * future. */ -class LIBDOLPHINPRIVATE_EXPORT KFileItemModelFilter +class DOLPHIN_EXPORT KFileItemModelFilter { public: diff --git a/src/kitemviews/private/kitemlistheaderwidget.h b/src/kitemviews/private/kitemlistheaderwidget.h index 74c9ac518..307def74d 100644 --- a/src/kitemviews/private/kitemlistheaderwidget.h +++ b/src/kitemviews/private/kitemlistheaderwidget.h @@ -20,7 +20,7 @@ #ifndef KITEMLISTHEADERWIDGET_H #define KITEMLISTHEADERWIDGET_H -#include "libdolphin_export.h" +#include "dolphin_export.h" #include #include #include @@ -33,7 +33,7 @@ class KItemModelBase; * The widget is an internal API, the user of KItemListView may only access the * class KItemListHeader. */ -class LIBDOLPHINPRIVATE_EXPORT KItemListHeaderWidget : public QGraphicsWidget +class DOLPHIN_EXPORT KItemListHeaderWidget : public QGraphicsWidget { Q_OBJECT diff --git a/src/kitemviews/private/kitemlistkeyboardsearchmanager.h b/src/kitemviews/private/kitemlistkeyboardsearchmanager.h index 1f315dabd..2a14ca470 100644 --- a/src/kitemviews/private/kitemlistkeyboardsearchmanager.h +++ b/src/kitemviews/private/kitemlistkeyboardsearchmanager.h @@ -23,7 +23,7 @@ #ifndef KITEMLISTKEYBOARDSEARCHMANAGER_H #define KITEMLISTKEYBOARDSEARCHMANAGER_H -#include "libdolphin_export.h" +#include "dolphin_export.h" #include #include @@ -35,7 +35,7 @@ * @see KItemListController * @see KItemModelBase */ -class LIBDOLPHINPRIVATE_EXPORT KItemListKeyboardSearchManager : public QObject +class DOLPHIN_EXPORT KItemListKeyboardSearchManager : public QObject { Q_OBJECT diff --git a/src/kitemviews/private/kitemlistroleeditor.h b/src/kitemviews/private/kitemlistroleeditor.h index 7c2b61e2d..3b8f96865 100644 --- a/src/kitemviews/private/kitemlistroleeditor.h +++ b/src/kitemviews/private/kitemlistroleeditor.h @@ -20,7 +20,7 @@ #ifndef KITEMLISTROLEEDITOR_H #define KITEMLISTROLEEDITOR_H -#include "libdolphin_export.h" +#include "dolphin_export.h" #include @@ -33,7 +33,7 @@ * * The size automatically gets increased if the text does not fit. */ -class LIBDOLPHINPRIVATE_EXPORT KItemListRoleEditor : public KTextEdit +class DOLPHIN_EXPORT KItemListRoleEditor : public KTextEdit { Q_OBJECT diff --git a/src/kitemviews/private/kitemlistrubberband.h b/src/kitemviews/private/kitemlistrubberband.h index 39c7573ae..b47c30c1f 100644 --- a/src/kitemviews/private/kitemlistrubberband.h +++ b/src/kitemviews/private/kitemlistrubberband.h @@ -20,14 +20,14 @@ #ifndef KITEMLISTRUBBERBAND_H #define KITEMLISTRUBBERBAND_H -#include "libdolphin_export.h" +#include "dolphin_export.h" #include #include /** * @brief Manages the rubberband when selecting items. */ -class LIBDOLPHINPRIVATE_EXPORT KItemListRubberBand : public QObject +class DOLPHIN_EXPORT KItemListRubberBand : public QObject { Q_OBJECT diff --git a/src/kitemviews/private/kitemlistselectiontoggle.h b/src/kitemviews/private/kitemlistselectiontoggle.h index bd64879af..d058ee988 100644 --- a/src/kitemviews/private/kitemlistselectiontoggle.h +++ b/src/kitemviews/private/kitemlistselectiontoggle.h @@ -20,7 +20,7 @@ #ifndef KITEMLISTSELECTIONTOGGLE_H #define KITEMLISTSELECTIONTOGGLE_H -#include "libdolphin_export.h" +#include "dolphin_export.h" #include #include @@ -29,7 +29,7 @@ /** * @brief Allows to toggle between the selected and unselected state of an item. */ -class LIBDOLPHINPRIVATE_EXPORT KItemListSelectionToggle : public QGraphicsWidget +class DOLPHIN_EXPORT KItemListSelectionToggle : public QGraphicsWidget { Q_OBJECT diff --git a/src/kitemviews/private/kitemlistsizehintresolver.h b/src/kitemviews/private/kitemlistsizehintresolver.h index 3bd2319dd..ff17f2de2 100644 --- a/src/kitemviews/private/kitemlistsizehintresolver.h +++ b/src/kitemviews/private/kitemlistsizehintresolver.h @@ -20,7 +20,7 @@ #ifndef KITEMLISTSIZEHINTRESOLVER_H #define KITEMLISTSIZEHINTRESOLVER_H -#include "libdolphin_export.h" +#include "dolphin_export.h" #include #include @@ -31,7 +31,7 @@ class KItemListView; /** * @brief Calculates and caches the sizehints of items in KItemListView. */ -class LIBDOLPHINPRIVATE_EXPORT KItemListSizeHintResolver +class DOLPHIN_EXPORT KItemListSizeHintResolver { public: KItemListSizeHintResolver(const KItemListView* itemListView); diff --git a/src/kitemviews/private/kitemlistsmoothscroller.h b/src/kitemviews/private/kitemlistsmoothscroller.h index 963cf7b24..fca4b0c53 100644 --- a/src/kitemviews/private/kitemlistsmoothscroller.h +++ b/src/kitemviews/private/kitemlistsmoothscroller.h @@ -20,7 +20,7 @@ #ifndef KITEMLISTSMOOTHSCROLLER_H #define KITEMLISTSMOOTHSCROLLER_H -#include "libdolphin_export.h" +#include "dolphin_export.h" #include #include @@ -33,7 +33,7 @@ class QWheelEvent; * @brief Helper class for KItemListContainer to have a smooth * scrolling when adjusting the scrollbars. */ -class LIBDOLPHINPRIVATE_EXPORT KItemListSmoothScroller : public QObject +class DOLPHIN_EXPORT KItemListSmoothScroller : public QObject { Q_OBJECT diff --git a/src/kitemviews/private/kitemlistviewanimation.h b/src/kitemviews/private/kitemlistviewanimation.h index ed4ec4902..06c81c9b8 100644 --- a/src/kitemviews/private/kitemlistviewanimation.h +++ b/src/kitemviews/private/kitemlistviewanimation.h @@ -20,7 +20,7 @@ #ifndef KITEMLISTVIEWANIMATION_H #define KITEMLISTVIEWANIMATION_H -#include "libdolphin_export.h" +#include "dolphin_export.h" #include #include @@ -36,7 +36,7 @@ class QPropertyAnimation; * Supports item animations for moving, creating, deleting and resizing * an item. Several applications can be applied to one item in parallel. */ -class LIBDOLPHINPRIVATE_EXPORT KItemListViewAnimation : public QObject +class DOLPHIN_EXPORT KItemListViewAnimation : public QObject { Q_OBJECT diff --git a/src/kitemviews/private/kitemlistviewlayouter.h b/src/kitemviews/private/kitemlistviewlayouter.h index fc82d6061..3f1cf68d4 100644 --- a/src/kitemviews/private/kitemlistviewlayouter.h +++ b/src/kitemviews/private/kitemlistviewlayouter.h @@ -20,7 +20,7 @@ #ifndef KITEMLISTVIEWLAYOUTER_H #define KITEMLISTVIEWLAYOUTER_H -#include "libdolphin_export.h" +#include "dolphin_export.h" #include #include @@ -45,7 +45,7 @@ class KItemListSizeHintResolver; * changing properties of the layouter is not expensive, only the * first read of a property can get expensive. */ -class LIBDOLPHINPRIVATE_EXPORT KItemListViewLayouter : public QObject +class DOLPHIN_EXPORT KItemListViewLayouter : public QObject { Q_OBJECT diff --git a/src/kitemviews/private/kpixmapmodifier.h b/src/kitemviews/private/kpixmapmodifier.h index b5eec6542..e8ca11ac1 100644 --- a/src/kitemviews/private/kpixmapmodifier.h +++ b/src/kitemviews/private/kpixmapmodifier.h @@ -20,12 +20,12 @@ #ifndef KPIXMAPMODIFIER_H #define KPIXMAPMODIFIER_H -#include "libdolphin_export.h" +#include "dolphin_export.h" class QPixmap; class QSize; -class LIBDOLPHINPRIVATE_EXPORT KPixmapModifier +class DOLPHIN_EXPORT KPixmapModifier { public: static void scale(QPixmap& pixmap, const QSize& scaledSize); diff --git a/src/settings/viewpropertiesdialog.h b/src/settings/viewpropertiesdialog.h index 63c534b30..5490be85b 100644 --- a/src/settings/viewpropertiesdialog.h +++ b/src/settings/viewpropertiesdialog.h @@ -21,7 +21,7 @@ #ifndef VIEWPROPERTIESDIALOG_H #define VIEWPROPERTIESDIALOG_H -#include "libdolphin_export.h" +#include "dolphin_export.h" #include @@ -39,7 +39,7 @@ class DolphinView; * and previews should be shown. The properties can be assigned to the current folder, * or recursively to all sub folders. */ -class LIBDOLPHINPRIVATE_EXPORT ViewPropertiesDialog : public QDialog +class DOLPHIN_EXPORT ViewPropertiesDialog : public QDialog { Q_OBJECT diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index 1c6c5b40c..22a8b4849 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -4,7 +4,7 @@ find_package(Qt5Test CONFIG REQUIRED) include(ECMMarkAsTest) # needed on windows to correctly use the files from dolphinprivate -add_definitions(-DLIBDOLPHINPRIVATE_EXPORT=) +add_definitions(-DDOLPHIN_EXPORT=) # KItemSetTest set(kitemsettest_SRCS diff --git a/src/views/dolphinfileitemlistwidget.cpp b/src/views/dolphinfileitemlistwidget.cpp index e8345435e..f15230841 100644 --- a/src/views/dolphinfileitemlistwidget.cpp +++ b/src/views/dolphinfileitemlistwidget.cpp @@ -21,7 +21,6 @@ #include #include -#include #include #include "dolphindebug.h" @@ -43,7 +42,7 @@ void DolphinFileItemListWidget::refreshCache() if (values.contains("version")) { // The item is under version control. Apply the text color corresponding // to its version state. - const KVersionControlPlugin2::ItemVersion version = static_cast(values.value("version").toInt()); + const KVersionControlPlugin::ItemVersion version = static_cast(values.value("version").toInt()); const QColor textColor = styleOption().palette.text().color(); QColor tintColor = textColor; @@ -51,16 +50,16 @@ void DolphinFileItemListWidget::refreshCache() // as tint colors and are mixed with the current set text color. The tint colors // have been optimized for the base colors of the corresponding Oxygen emblems. switch (version) { - case KVersionControlPlugin2::UpdateRequiredVersion: tintColor = Qt::yellow; break; - case KVersionControlPlugin2::LocallyModifiedUnstagedVersion: tintColor = Qt::green; break; - case KVersionControlPlugin2::LocallyModifiedVersion: tintColor = Qt::green; break; - case KVersionControlPlugin2::AddedVersion: tintColor = Qt::green; break; - case KVersionControlPlugin2::RemovedVersion: tintColor = Qt::darkRed; break; - case KVersionControlPlugin2::ConflictingVersion: tintColor = Qt::red; break; - case KVersionControlPlugin2::IgnoredVersion: tintColor = Qt::white; break; - case KVersionControlPlugin2::MissingVersion: tintColor = Qt::red; break; - case KVersionControlPlugin2::NormalVersion: - case KVersionControlPlugin2::UnversionedVersion: + case KVersionControlPlugin::UpdateRequiredVersion: tintColor = Qt::yellow; break; + case KVersionControlPlugin::LocallyModifiedUnstagedVersion: tintColor = Qt::green; break; + case KVersionControlPlugin::LocallyModifiedVersion: tintColor = Qt::green; break; + case KVersionControlPlugin::AddedVersion: tintColor = Qt::green; break; + case KVersionControlPlugin::RemovedVersion: tintColor = Qt::darkRed; break; + case KVersionControlPlugin::ConflictingVersion: tintColor = Qt::red; break; + case KVersionControlPlugin::IgnoredVersion: tintColor = Qt::white; break; + case KVersionControlPlugin::MissingVersion: tintColor = Qt::red; break; + case KVersionControlPlugin::NormalVersion: + case KVersionControlPlugin::UnversionedVersion: default: break; } @@ -78,7 +77,7 @@ void DolphinFileItemListWidget::refreshCache() setTextColor(color); } -QPixmap DolphinFileItemListWidget::overlayForState(KVersionControlPlugin2::ItemVersion version, int size) +QPixmap DolphinFileItemListWidget::overlayForState(KVersionControlPlugin::ItemVersion version, int size) { int overlayHeight = KIconLoader::SizeSmall; if (size >= KIconLoader::SizeEnormous) { @@ -115,8 +114,8 @@ QPixmap DolphinFileItemListWidget::overlayForState(KVersionControlPlugin2::ItemV iconName = "vcs-conflicting"; break; case KVersionControlPlugin::UnversionedVersion: - case KVersionControlPlugin2::IgnoredVersion: - case KVersionControlPlugin2::MissingVersion: + case KVersionControlPlugin::IgnoredVersion: + case KVersionControlPlugin::MissingVersion: break; default: Q_ASSERT(false); diff --git a/src/views/dolphinfileitemlistwidget.h b/src/views/dolphinfileitemlistwidget.h index 5f9cc3a5a..af73ac937 100644 --- a/src/views/dolphinfileitemlistwidget.h +++ b/src/views/dolphinfileitemlistwidget.h @@ -20,10 +20,10 @@ #ifndef DOLPHINFILEITEMLISTWIDGET_H #define DOLPHINFILEITEMLISTWIDGET_H -#include "libdolphin_export.h" +#include "dolphin_export.h" #include -#include +#include "versioncontrol/kversioncontrolplugin.h" /** * @brief Extends KFileItemListWidget to handle the "version" role. @@ -31,7 +31,7 @@ * The "version" role is set if version-control-plugins have been enabled. * @see KVersionControlPlugin */ -class LIBDOLPHINPRIVATE_EXPORT DolphinFileItemListWidget : public KFileItemListWidget +class DOLPHIN_EXPORT DolphinFileItemListWidget : public KFileItemListWidget { Q_OBJECT @@ -43,7 +43,7 @@ protected: virtual void refreshCache() Q_DECL_OVERRIDE; private: - static QPixmap overlayForState(KVersionControlPlugin2::ItemVersion version, int size); + static QPixmap overlayForState(KVersionControlPlugin::ItemVersion version, int size); }; diff --git a/src/views/dolphinitemlistview.h b/src/views/dolphinitemlistview.h index 2b16825f4..7eec6f17a 100644 --- a/src/views/dolphinitemlistview.h +++ b/src/views/dolphinitemlistview.h @@ -23,7 +23,7 @@ #include #include -#include "libdolphin_export.h" +#include "dolphin_export.h" class KFileItemListView; @@ -34,7 +34,7 @@ class KFileItemListView; * the view-properties into the corresponding KItemListView * properties. */ -class LIBDOLPHINPRIVATE_EXPORT DolphinItemListView : public KFileItemListView +class DOLPHIN_EXPORT DolphinItemListView : public KFileItemListView { Q_OBJECT diff --git a/src/views/dolphinnewfilemenuobserver.h b/src/views/dolphinnewfilemenuobserver.h index b9b18e229..df4621f17 100644 --- a/src/views/dolphinnewfilemenuobserver.h +++ b/src/views/dolphinnewfilemenuobserver.h @@ -22,7 +22,7 @@ #include -#include "libdolphin_export.h" +#include "dolphin_export.h" class DolphinNewFileMenu; @@ -33,7 +33,7 @@ class DolphinNewFileMenu; * As soon as a DolphinNewFileMenu instance created a new item, * the observer will emit the signal itemCreated(). */ -class LIBDOLPHINPRIVATE_EXPORT DolphinNewFileMenuObserver : public QObject +class DOLPHIN_EXPORT DolphinNewFileMenuObserver : public QObject { Q_OBJECT diff --git a/src/views/dolphinremoteencoding.h b/src/views/dolphinremoteencoding.h index 0351abad7..28ff52cb3 100644 --- a/src/views/dolphinremoteencoding.h +++ b/src/views/dolphinremoteencoding.h @@ -23,7 +23,7 @@ #include #include #include -#include "libdolphin_export.h" +#include "dolphin_export.h" class KActionMenu; @@ -35,7 +35,7 @@ class DolphinViewActionHandler; * When browsing remote url, its possible to change encoding from Tools Menu. */ -class LIBDOLPHINPRIVATE_EXPORT DolphinRemoteEncoding: public QObject +class DOLPHIN_EXPORT DolphinRemoteEncoding: public QObject { Q_OBJECT public: diff --git a/src/views/dolphinview.h b/src/views/dolphinview.h index aa4492bc3..24b560f10 100644 --- a/src/views/dolphinview.h +++ b/src/views/dolphinview.h @@ -23,7 +23,7 @@ #include -#include "libdolphin_export.h" +#include "dolphin_export.h" #include #include @@ -57,7 +57,7 @@ class QRegExp; * - show previews * - enable grouping */ -class LIBDOLPHINPRIVATE_EXPORT DolphinView : public QWidget +class DOLPHIN_EXPORT DolphinView : public QWidget { Q_OBJECT diff --git a/src/views/dolphinviewactionhandler.h b/src/views/dolphinviewactionhandler.h index bf664f731..eb375b5c9 100644 --- a/src/views/dolphinviewactionhandler.h +++ b/src/views/dolphinviewactionhandler.h @@ -22,7 +22,7 @@ #ifndef DOLPHINVIEWACTIONHANDLER_H #define DOLPHINVIEWACTIONHANDLER_H -#include "libdolphin_export.h" +#include "dolphin_export.h" #include "views/dolphinview.h" #include @@ -46,7 +46,7 @@ class KActionCollection; * @see DolphinMainWindow * @see DolphinPart */ -class LIBDOLPHINPRIVATE_EXPORT DolphinViewActionHandler : public QObject +class DOLPHIN_EXPORT DolphinViewActionHandler : public QObject { Q_OBJECT diff --git a/src/views/draganddrophelper.h b/src/views/draganddrophelper.h index 0fbe3a128..fe77b1e6e 100644 --- a/src/views/draganddrophelper.h +++ b/src/views/draganddrophelper.h @@ -21,7 +21,7 @@ #ifndef DRAGANDDROPHELPER_H #define DRAGANDDROPHELPER_H -#include "libdolphin_export.h" +#include "dolphin_export.h" class QUrl; @@ -29,7 +29,7 @@ class QDropEvent; class QWidget; namespace KIO { class DropJob; } -class LIBDOLPHINPRIVATE_EXPORT DragAndDropHelper +class DOLPHIN_EXPORT DragAndDropHelper { public: /** diff --git a/src/views/renamedialog.h b/src/views/renamedialog.h index 7c02d1b87..a1953e8b3 100644 --- a/src/views/renamedialog.h +++ b/src/views/renamedialog.h @@ -20,7 +20,7 @@ #ifndef RENAMEDIALOG_H #define RENAMEDIALOG_H -#include "libdolphin_export.h" +#include "dolphin_export.h" #include #include @@ -33,7 +33,7 @@ class QPushButton; /** * @brief Dialog for renaming a variable number of files. */ -class LIBDOLPHINPRIVATE_EXPORT RenameDialog : public QDialog +class DOLPHIN_EXPORT RenameDialog : public QDialog { Q_OBJECT diff --git a/src/views/versioncontrol/kversioncontrolplugin.cpp b/src/views/versioncontrol/kversioncontrolplugin.cpp new file mode 100644 index 000000000..2c0632878 --- /dev/null +++ b/src/views/versioncontrol/kversioncontrolplugin.cpp @@ -0,0 +1,29 @@ +/***************************************************************************** + * Copyright (C) 2011 by Vishesh Yadav * + * Copyright (C) 2011 by Peter Penz * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Library General Public * + * License version 2 as published by the Free Software Foundation. * + * * + * 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 * + * Library General Public License for more details. * + * * + * You should have received a copy of the GNU Library General Public License * + * along with this library; see the file COPYING.LIB. If not, write to * + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * + * Boston, MA 02110-1301, USA. * + *****************************************************************************/ + +#include "kversioncontrolplugin.h" + +KVersionControlPlugin::KVersionControlPlugin(QObject* parent) : + QObject(parent) +{ +} + +KVersionControlPlugin::~KVersionControlPlugin() +{ +} diff --git a/src/views/versioncontrol/kversioncontrolplugin.h b/src/views/versioncontrol/kversioncontrolplugin.h new file mode 100644 index 000000000..e5a267848 --- /dev/null +++ b/src/views/versioncontrol/kversioncontrolplugin.h @@ -0,0 +1,223 @@ +/***************************************************************************** + * Copyright (C) 2011 by Vishesh Yadav * + * Copyright (C) 2011 by Peter Penz * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Library General Public * + * License version 2 as published by the Free Software Foundation. * + * * + * 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 * + * Library General Public License for more details. * + * * + * You should have received a copy of the GNU Library General Public License * + * along with this library; see the file COPYING.LIB. If not, write to * + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * + * Boston, MA 02110-1301, USA. * + *****************************************************************************/ + +#ifndef KVERSIONCONTROLPLUGIN_H +#define KVERSIONCONTROLPLUGIN_H + +#include + +#include +#include +#include + +/** + * @brief Base class for version control plugins. + * + * Enables the file manager to show the version state + * of a versioned file. To write a custom plugin, the following + * steps are required (in the example below it is assumed that a plugin for + * Subversion will be written): + * + * - Create a fileviewsvnplugin.desktop file with the following content: + * + * [Desktop Entry] + * Type=Service + * Name=Subversion + * X-KDE-ServiceTypes=FileViewVersionControlPlugin + * MimeType=text/plain; + * X-KDE-Library=fileviewsvnplugin + * + * + * - Create a class FileViewSvnPlugin derived from KVersionControlPlugin and + * implement all abstract interfaces (fileviewsvnplugin.h, fileviewsvnplugin.cpp). + * + * - Take care that the constructor has the following signature: + * + * FileViewSvnPlugin(QObject* parent, const QList& args); + * + * + * - Add the following lines at the top of fileviewsvnplugin.cpp: + * + * #include + * #include + * K_PLUGIN_FACTORY(FileViewSvnPluginFactory, registerPlugin();) + * K_EXPORT_PLUGIN(FileViewSvnPluginFactory("fileviewsvnplugin")) + * + * + * - Add the following lines to your CMakeLists.txt file: + * + * kde4_add_plugin(fileviewsvnplugin fileviewsvnplugin.cpp) + * target_link_libraries(fileviewsvnplugin konq) + * install(FILES fileviewsvnplugin.desktop DESTINATION ${SERVICES_INSTALL_DIR}) + * + * + * General implementation notes: + * + * - The implementations of beginRetrieval(), endRetrieval() and versionState() + * can contain blocking operations, as Dolphin will execute + * those methods in a separate thread. It is assured that + * all other methods are invoked in a serialized way, so that it is not necessary for + * the plugin to use any mutex. + * + * - Dolphin keeps only one instance of the plugin, which is instantiated shortly after + * starting Dolphin. Take care that the constructor does no expensive and time + * consuming operations. + * + * @since 4.8 + */ +class DOLPHIN_EXPORT KVersionControlPlugin : public QObject +{ + Q_OBJECT + +public: + enum ItemVersion + { + /** The file is not under version control. */ + UnversionedVersion, + /** + * The file is under version control and represents + * the latest version. + */ + NormalVersion, + /** + * The file is under version control and a newer + * version exists on the main branch. + */ + UpdateRequiredVersion, + /** + * The file is under version control and has been + * modified locally. All modifications will be part + * of the next commit. + */ + LocallyModifiedVersion, + /** + * The file has not been under version control but + * has been marked to get added with the next commit. + */ + AddedVersion, + /** + * The file is under version control but has been marked + * for getting removed with the next commit. + */ + RemovedVersion, + /** + * The file is under version control and has been locally + * modified. A modification has also been done on the main + * branch. + */ + ConflictingVersion, + /** + * The file is under version control and has local + * modifications, which will not be part of the next + * commit (or are "unstaged" in git jargon). + * @since 4.6 + */ + LocallyModifiedUnstagedVersion, + /** + * The file is not under version control and is listed + * in the ignore list of the version control system. + * @since 4.8 + */ + IgnoredVersion, + /** + * The file is is tracked by the version control system, but + * is missing in the directory (e.g. by deleted without using + * a version control command). + * @since 4.8 + */ + MissingVersion + }; + + KVersionControlPlugin(QObject* parent = 0); + virtual ~KVersionControlPlugin(); + + /** + * Returns the name of the file which stores + * the version controls information. + * (e. g. .svn, .cvs, .git). + */ + virtual QString fileName() const = 0; + + /** + * Is invoked whenever the version control + * information will get retrieved for the directory + * \p directory. It is assured that the directory + * contains a trailing slash. + */ + virtual bool beginRetrieval(const QString& directory) = 0; + + /** + * Is invoked after the version control information has been + * received. It is assured that + * KVersionControlPluginV2::beginInfoRetrieval() has been + * invoked before. + */ + virtual void endRetrieval() = 0; + + /** + * @return The version for the item \p item. + * It is assured that KVersionControlPlugin::beginInfoRetrieval() has been + * invoked before and that the file is part of the directory specified + * in beginInfoRetrieval(). + */ + virtual ItemVersion itemVersion(const KFileItem& item) const = 0; + + /** + * @return List of actions that are available for the items \p items. + * It is recommended to keep the number of returned actions small + * in case if an item is an unversioned directory that is not + * inside the hierarchy tree of the version control system. This + * prevents having a cluttered context menu for directories + * outside the version control system. + */ + virtual QList actions(const KFileItemList& items) const = 0; + +Q_SIGNALS: + /** + * Should be emitted when the version state of items might have been changed + * after the last retrieval (e. g. by executing a context menu action + * of the version control plugin). The file manager will be triggered to + * update the version states of the directory \p directory by invoking + * KVersionControlPlugin::beginRetrieval(), + * KVersionControlPlugin::itemVersion() and + * KVersionControlPlugin::endRetrieval(). + */ + void itemVersionsChanged(); + + /** + * Is emitted if an information message with the content \a msg + * should be shown. + */ + void infoMessage(const QString& msg); + + /** + * Is emitted if an error message with the content \a msg + * should be shown. + */ + void errorMessage(const QString& msg); + + /** + * Is emitted if an "operation completed" message with the content \a msg + * should be shown. + */ + void operationCompletedMessage(const QString& msg); +}; + +#endif // KVERSIONCONTROLPLUGIN_H + diff --git a/src/views/versioncontrol/updateitemstatesthread.cpp b/src/views/versioncontrol/updateitemstatesthread.cpp index 4f0122e0f..e4413fabf 100644 --- a/src/views/versioncontrol/updateitemstatesthread.cpp +++ b/src/views/versioncontrol/updateitemstatesthread.cpp @@ -19,9 +19,7 @@ #include "updateitemstatesthread.h" -#include #include - #include UpdateItemStatesThread::UpdateItemStatesThread(KVersionControlPlugin* plugin, @@ -53,20 +51,10 @@ void UpdateItemStatesThread::run() if (m_plugin->beginRetrieval(it.key())) { QVector& items = it.value(); const int count = items.count(); - - KVersionControlPlugin2* pluginV2 = qobject_cast(m_plugin); - if (pluginV2) { - for (int i = 0; i < count; ++i) { - const KFileItem& item = items.at(i).first; - const KVersionControlPlugin2::ItemVersion version = pluginV2->itemVersion(item); - items[i].second = version; - } - } else { - for (int i = 0; i < count; ++i) { - const KFileItem& item = items.at(i).first; - const KVersionControlPlugin::VersionState state = m_plugin->versionState(item); - items[i].second = static_cast(state); - } + for (int i = 0; i < count; ++i) { + const KFileItem& item = items.at(i).first; + const KVersionControlPlugin::ItemVersion version = m_plugin->itemVersion(item); + items[i].second = version; } } diff --git a/src/views/versioncontrol/updateitemstatesthread.h b/src/views/versioncontrol/updateitemstatesthread.h index 92a9d59c9..3dc03fc75 100644 --- a/src/views/versioncontrol/updateitemstatesthread.h +++ b/src/views/versioncontrol/updateitemstatesthread.h @@ -20,20 +20,18 @@ #ifndef UPDATEITEMSTATESTHREAD_H #define UPDATEITEMSTATESTHREAD_H -#include "libdolphin_export.h" +#include "dolphin_export.h" #include #include #include -class KVersionControlPlugin; - /** * The performance of updating the version state of items depends * on the used plugin. To prevent that Dolphin gets blocked by a * slow plugin, the updating is delegated to a thread. */ -class LIBDOLPHINPRIVATE_EXPORT UpdateItemStatesThread : public QThread +class DOLPHIN_EXPORT UpdateItemStatesThread : public QThread { Q_OBJECT diff --git a/src/views/versioncontrol/versioncontrolobserver.cpp b/src/views/versioncontrol/versioncontrolobserver.cpp index 47e3da357..13481cc7a 100644 --- a/src/views/versioncontrol/versioncontrolobserver.cpp +++ b/src/views/versioncontrol/versioncontrolobserver.cpp @@ -26,7 +26,6 @@ #include "dolphindebug.h" #include #include -#include #include "updateitemstatesthread.h" @@ -89,8 +88,6 @@ KFileItemModel* VersionControlObserver::model() const QList VersionControlObserver::actions(const KFileItemList& items) const { - QList actions; - bool hasNullItems = false; foreach (const KFileItem& item, items) { if (item.isNull()) { @@ -101,30 +98,10 @@ QList VersionControlObserver::actions(const KFileItemList& items) cons } if (!m_model || hasNullItems) { - return actions; - } - - KVersionControlPlugin2* pluginV2 = qobject_cast(m_plugin); - if (pluginV2) { - // Use version 2 of the KVersionControlPlugin which allows providing actions - // also for non-versioned directories. - actions = pluginV2->actions(items); - } else if (isVersioned()) { - // Support deprecated interfaces from KVersionControlPlugin version 1. - // Context menu actions where only available for versioned directories. - QString directory; - if (items.count() == 1) { - const KFileItem rootItem = m_model->rootItem(); - if (!rootItem.isNull() && items.first().url() == rootItem.url()) { - directory = rootItem.url().path(); - } - } - - actions = directory.isEmpty() ? m_plugin->contextMenuActions(items) - : m_plugin->contextMenuActions(directory); + return {}; } - return actions; + return m_plugin->actions(items); } void VersionControlObserver::delayedDirectoryVerification() @@ -156,14 +133,8 @@ void VersionControlObserver::verifyDirectory() m_plugin = searchPlugin(rootItem.url()); if (m_plugin) { - KVersionControlPlugin2* pluginV2 = qobject_cast(m_plugin); - if (pluginV2) { - connect(pluginV2, &KVersionControlPlugin2::itemVersionsChanged, - this, &VersionControlObserver::silentDirectoryVerification); - } else { - connect(m_plugin, &KVersionControlPlugin::versionStatesChanged, - this, &VersionControlObserver::silentDirectoryVerification); - } + connect(m_plugin, &KVersionControlPlugin::itemVersionsChanged, + this, &VersionControlObserver::silentDirectoryVerification); connect(m_plugin, &KVersionControlPlugin::infoMessage, this, &VersionControlObserver::infoMessage); connect(m_plugin, &KVersionControlPlugin::errorMessage, @@ -205,7 +176,7 @@ void VersionControlObserver::slotThreadFinished() foreach (const ItemState& item, items) { const KFileItem& fileItem = item.first; - const KVersionControlPlugin2::ItemVersion version = item.second; + const KVersionControlPlugin::ItemVersion version = item.second; QHash values; values.insert("version", QVariant(version)); m_model->setData(m_model->index(fileItem), values); @@ -268,7 +239,7 @@ int VersionControlObserver::createItemStatesList(QMapfileItem(index); - itemState.second = KVersionControlPlugin2::UnversionedVersion; + itemState.second = KVersionControlPlugin::UnversionedVersion; items.append(itemState); } else if (expansionLevel > currentExpansionLevel) { diff --git a/src/views/versioncontrol/versioncontrolobserver.h b/src/views/versioncontrol/versioncontrolobserver.h index a43dc3415..c817c2187 100644 --- a/src/views/versioncontrol/versioncontrolobserver.h +++ b/src/views/versioncontrol/versioncontrolobserver.h @@ -20,11 +20,13 @@ #ifndef VERSIONCONTROLOBSERVER_H #define VERSIONCONTROLOBSERVER_H -#include "libdolphin_export.h" +#include "dolphin_export.h" + +#include "kversioncontrolplugin.h" #include + #include -#include #include #include #include @@ -43,7 +45,7 @@ class UpdateItemStatesThread; * * @see VersionControlPlugin */ -class LIBDOLPHINPRIVATE_EXPORT VersionControlObserver : public QObject +class DOLPHIN_EXPORT VersionControlObserver : public QObject { Q_OBJECT @@ -100,7 +102,7 @@ private slots: void slotThreadFinished(); private: - typedef QPair ItemState; + typedef QPair ItemState; void updateItemStates(); diff --git a/src/views/viewmodecontroller.h b/src/views/viewmodecontroller.h index 89f1020b5..4b1ff2083 100644 --- a/src/views/viewmodecontroller.h +++ b/src/views/viewmodecontroller.h @@ -22,7 +22,7 @@ #include #include -#include "libdolphin_export.h" +#include "dolphin_export.h" #include /** @@ -33,7 +33,7 @@ * connect to signals of the ViewModeController to react on changes. The view * implementations get only read-access to the ViewModeController. */ -class LIBDOLPHINPRIVATE_EXPORT ViewModeController : public QObject +class DOLPHIN_EXPORT ViewModeController : public QObject { Q_OBJECT diff --git a/src/views/viewproperties.h b/src/views/viewproperties.h index b9c2fa546..dc118e2d7 100644 --- a/src/views/viewproperties.h +++ b/src/views/viewproperties.h @@ -23,7 +23,7 @@ #include #include -#include "libdolphin_export.h" +#include "dolphin_export.h" class ViewPropertySettings; /** @@ -47,7 +47,7 @@ class ViewPropertySettings; * (see GeneralSettings::globalViewMode()), the values from the global .directory file * are used for initialization. */ -class LIBDOLPHINPRIVATE_EXPORT ViewProperties +class DOLPHIN_EXPORT ViewProperties { public: explicit ViewProperties(const QUrl& url); -- cgit v1.3.1 From 8a7d9b6d2c308563397d13f5e9430334201620bb Mon Sep 17 00:00:00 2001 From: Emmanuel Pescosta Date: Wed, 25 Feb 2015 21:45:19 +0100 Subject: Bump the Qt version to 5.4 and the KF5 version to 5.7 Added all required components Reviewed-By: David Edmundson --- CMakeLists.txt | 38 +++++++++++++++++++++++++++++++++----- src/CMakeLists.txt | 2 +- src/main.cpp | 2 +- 3 files changed, 35 insertions(+), 7 deletions(-) (limited to 'src/CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 5a007f302..f31def98e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,12 +2,16 @@ cmake_minimum_required(VERSION 2.8.12) project(Dolphin) +set(DOLPHIN_VERSION "14.12.95") + +set(QT_MIN_VERSION "5.4.0") +set(KF5_MIN_VERSION "5.7.0") +set(ECM_MIN_VERSION "1.6.0") + # ECM setup -find_package(ECM 1.6.0 CONFIG REQUIRED) +find_package(ECM ${ECM_MIN_VERSION} CONFIG REQUIRED) set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH}) -set(DOLPHIN_VERSION "4.97.0") - include(ECMSetupVersion) include(ECMGenerateHeaders) include(ECMPackageConfigHelpers) @@ -27,8 +31,32 @@ ecm_setup_version(${DOLPHIN_VERSION} VARIABLE_PREFIX DOLPHINPRIVATE SOVERSION 5 ) -find_package(KF5 REQUIRED COMPONENTS DocTools Init KCMUtils KDELibs4Support NewStuff CoreAddons I18n DBusAddons) -find_package(KF5 COMPONENTS Activities) +find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS + Core + Widgets + Gui + DBus + Test +) + +find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS + DocTools + Init + KCMUtils + KDELibs4Support + NewStuff + CoreAddons + I18n + DBusAddons + Bookmarks + Config + KIO + Parts + Solid +) +find_package(KF5 ${KF5_MIN_VERSION} COMPONENTS + Activities +) find_package(Phonon4Qt5 CONFIG REQUIRED) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2b65671da..94aa5a51c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -3,7 +3,7 @@ configure_file(config-baloo.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-baloo.h) configure_file(config-dolphin.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-dolphin.h) -add_definitions(-DTRANSLATION_DOMAIN=\"dolphin\") +add_definitions(-DTRANSLATION_DOMAIN=\"dolphin\" -DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS) remove_definitions(-DQT_NO_CAST_FROM_BYTEARRAY -DQT_NO_URL_CAST_FROM_STRING) if(X11_Xrender_FOUND) diff --git a/src/main.cpp b/src/main.cpp index b8eb9a556..e8d6c2d29 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -41,7 +41,7 @@ extern "C" Q_DECL_EXPORT int kdemain(int argc, char **argv) app.setWindowIcon(QIcon::fromTheme("system-file-manager")); - KAboutData aboutData("dolphin", i18n("Dolphin"), "4.60", + KAboutData aboutData("dolphin", i18n("Dolphin"), "14.12.95", i18nc("@title", "File Manager"), KAboutLicense::GPL, i18nc("@info:credit", "(C) 2006-2014 Peter Penz, Frank Reininghaus, and Emmanuel Pescosta")); -- cgit v1.3.1 From 6787467a7b3b54971ce023c1ba1a36b5d1a7c499 Mon Sep 17 00:00:00 2001 From: Emmanuel Pescosta Date: Thu, 26 Feb 2015 17:09:46 +0100 Subject: Revert "Use the Baloo Query Builder widget to add syntax-highlighting in Dolphin search" The natural query parser is too unstable for the release atm, we'll readd the query parser when the code is mature enough. This reverts commit e3578ee3b770a1b8f359ed1a3cc6e3ac7f6c700e. --- src/CMakeLists.txt | 1 - src/search/dolphinsearchbox.cpp | 52 +++++++++++------------------------------ src/search/dolphinsearchbox.h | 18 +++----------- 3 files changed, 17 insertions(+), 54 deletions(-) (limited to 'src/CMakeLists.txt') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 94aa5a51c..1b04a642b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -141,7 +141,6 @@ if(HAVE_BALOO) dolphinprivate PUBLIC KF5::FileMetaData KF5::Baloo - KF5::BalooNaturalQueryParser KF5::BalooWidgets ) endif() diff --git a/src/search/dolphinsearchbox.cpp b/src/search/dolphinsearchbox.cpp index fe298312f..9e908de5d 100644 --- a/src/search/dolphinsearchbox.cpp +++ b/src/search/dolphinsearchbox.cpp @@ -38,9 +38,8 @@ #include #include +#include #ifdef HAVE_BALOO - #include - #include #include #include #include @@ -251,9 +250,8 @@ void DolphinSearchBox::slotConfigurationChanged() } } -void DolphinSearchBox::slotSearchTextChanged() +void DolphinSearchBox::slotSearchTextChanged(const QString& text) { - const QString text = m_searchInput->text(); if (text.isEmpty()) { m_startSearchTimer->stop(); @@ -266,14 +264,7 @@ void DolphinSearchBox::slotSearchTextChanged() void DolphinSearchBox::slotReturnPressed() { emitSearchRequest(); - emit returnPressed(m_searchInput->text()); -} - -void DolphinSearchBox::updateSearchInputParsing() -{ -#ifdef HAVE_BALOO - m_searchInput->setParsingEnabled(m_contentButton->isChecked()); -#endif + emit returnPressed(); } void DolphinSearchBox::slotFacetsButtonToggled() @@ -314,7 +305,6 @@ void DolphinSearchBox::loadSettings() } m_facetsWidget->setVisible(SearchSettings::showFacetsWidget()); - updateSearchInputParsing(); } void DolphinSearchBox::saveSettings() @@ -338,14 +328,6 @@ void DolphinSearchBox::init() m_searchLabel = new QLabel(this); // Create search box -#ifdef HAVE_BALOO - m_queryParser.reset(new Baloo::NaturalFileQueryParser); - m_searchInput = new Baloo::QueryBuilder(m_queryParser.data(), this); - connect(m_searchInput, &Baloo::QueryBuilder::editingFinished, - this, &DolphinSearchBox::slotReturnPressed); - connect(m_searchInput, &Baloo::QueryBuilder::textChanged, - this, &DolphinSearchBox::slotSearchTextChanged); -#else m_searchInput = new QLineEdit(this); m_searchInput->installEventFilter(this); m_searchInput->setClearButtonEnabled(true); @@ -354,7 +336,6 @@ void DolphinSearchBox::init() this, &DolphinSearchBox::slotReturnPressed); connect(m_searchInput, &QLineEdit::textChanged, this, &DolphinSearchBox::slotSearchTextChanged); -#endif setFocusProxy(m_searchInput); // Apply layout for the search input @@ -376,8 +357,6 @@ void DolphinSearchBox::init() QButtonGroup* searchWhatGroup = new QButtonGroup(this); searchWhatGroup->addButton(m_fileNameButton); searchWhatGroup->addButton(m_contentButton); - connect(searchWhatGroup, static_cast(&QButtonGroup::buttonClicked), - this, &DolphinSearchBox::updateSearchInputParsing); m_separator = new KSeparator(Qt::Vertical, this); @@ -454,31 +433,28 @@ QUrl DolphinSearchBox::balooUrlForSearching() const const QString text = m_searchInput->text(); Baloo::Query query; - - if (m_contentButton->isChecked()) { - query = m_queryParser->parse(text, Baloo::NaturalQueryParser::DetectFilenamePattern); - } else { - query.setTerm(Baloo::Term(QLatin1String("filename"), text)); - } - - // Configure the query so that it returns files and takes the rating into account query.addType("File"); query.addType(m_facetsWidget->facetType()); Baloo::Term term(Baloo::Term::And); - Baloo::Term ratingTerm = m_facetsWidget->ratingTerm(); + Baloo::Term ratingTerm = m_facetsWidget->ratingTerm(); if (ratingTerm.isValid()) { - term.addSubTerm(query.term()); term.addSubTerm(ratingTerm); + } - query.setTerm(term); + if (m_contentButton->isChecked()) { + query.setSearchString(text); + } else if (!text.isEmpty()) { + term.addSubTerm(Baloo::Term(QLatin1String("filename"), text)); } if (m_fromHereButton->isChecked()) { query.setIncludeFolder(m_searchPath.toLocalFile()); } + query.setTerm(term); + return query.toSearchUrl(i18nc("@title UDS_DISPLAY_NAME for a KIO directory listing. %1 is the query the user entered.", "Query Results from '%1'", text)); #else @@ -503,9 +479,7 @@ void DolphinSearchBox::fromBalooSearchUrl(const QUrl& url) setSearchPath(QDir::homePath()); } - if (!query.searchString().isEmpty()) { - setText(query.searchString()); - } + setText(query.searchString()); QStringList types = query.types(); types.removeOne("File"); // We are only interested in facet widget types @@ -525,6 +499,8 @@ void DolphinSearchBox::fromBalooSearchUrl(const QUrl& url) m_startSearchTimer->stop(); blockSignals(false); +#else + Q_UNUSED(url); #endif } diff --git a/src/search/dolphinsearchbox.h b/src/search/dolphinsearchbox.h index ef48d0830..a80617476 100644 --- a/src/search/dolphinsearchbox.h +++ b/src/search/dolphinsearchbox.h @@ -23,8 +23,6 @@ #include #include -#include - class DolphinFacetsWidget; class QLineEdit; class KSeparator; @@ -33,11 +31,6 @@ class QScrollArea; class QLabel; class QVBoxLayout; -namespace Baloo { - class QueryBuilder; - class NaturalQueryParser; -} - /** * @brief Input box for searching files with or without Baloo. * @@ -122,7 +115,7 @@ signals: */ void searchTextChanged(const QString& text); - void returnPressed(const QString& text); + void returnPressed(); /** * Emitted as soon as the search box should get closed. @@ -140,11 +133,10 @@ private slots: void emitSearchRequest(); void emitCloseRequest(); void slotConfigurationChanged(); - void slotSearchTextChanged(); + void slotSearchTextChanged(const QString& text); void slotReturnPressed(); void slotFacetsButtonToggled(); void slotFacetChanged(); - void updateSearchInputParsing(); private: void initButton(QToolButton* button); @@ -164,6 +156,7 @@ private: void fromBalooSearchUrl(const QUrl& url); void updateFacetsToggleButton(); + private: bool m_startedSearching; bool m_active; @@ -171,12 +164,7 @@ private: QVBoxLayout* m_topLayout; QLabel* m_searchLabel; -#ifdef HAVE_BALOO - Baloo::QueryBuilder* m_searchInput; - QScopedPointer m_queryParser; -#else QLineEdit* m_searchInput; -#endif QScrollArea* m_optionsScrollArea; QToolButton* m_fileNameButton; QToolButton* m_contentButton; -- cgit v1.3.1 From 832e157ecd1a1640b82425358b20fff416a2f8b7 Mon Sep 17 00:00:00 2001 From: Emmanuel Pescosta Date: Thu, 26 Feb 2015 17:40:06 +0100 Subject: Port away from KDELibs4Support (we only use KDELibs4Support when baloo isn't present, because KFileMetaDataWidget is in KDELibs4Support) Reviewed-By: Vishesh Handa --- CMakeLists.txt | 10 +++++- src/CMakeLists.txt | 47 ++++++++++++++++++------- src/dolphinmainwindow.cpp | 6 ++-- src/dolphinmainwindow.h | 4 +-- src/dolphinpart.cpp | 7 ++-- src/kitemviews/kitemlistcontroller.cpp | 7 ++-- src/panels/folders/folderspanel.cpp | 4 +-- src/panels/folders/treeviewcontextmenu.cpp | 3 +- src/panels/places/placesitemeditdialog.cpp | 1 - src/panels/places/placesitemmodel.cpp | 2 -- src/search/dolphinsearchbox.cpp | 18 ++++++---- src/settings/startup/startupsettingspage.cpp | 4 +-- src/settings/viewmodes/dolphinfontrequester.cpp | 10 +++--- src/settings/viewpropertiesdialog.cpp | 1 - src/tests/kfileitemlistviewtest.cpp | 2 +- src/tests/kfileitemmodelbenchmark.cpp | 10 +++--- src/tests/kfileitemmodeltest.cpp | 10 +++--- src/tests/kitemlistcontrollertest.cpp | 4 +-- src/views/dolphinview.cpp | 1 - src/views/renamedialog.cpp | 1 - 20 files changed, 96 insertions(+), 56 deletions(-) (limited to 'src/CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index f31def98e..9c2b109af 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,7 +43,6 @@ find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS DocTools Init KCMUtils - KDELibs4Support NewStuff CoreAddons I18n @@ -53,6 +52,11 @@ find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS KIO Parts Solid + IconThemes + Completion + TextEditor + WindowSystem + Notifications ) find_package(KF5 ${KF5_MIN_VERSION} COMPONENTS Activities @@ -83,6 +87,10 @@ set_package_properties(KF5FileMetaData PROPERTIES if (KF5Baloo_FOUND AND KF5BalooWidgets_FOUND AND KF5FileMetaData_FOUND) message(STATUS "Baloo packages are found") set(HAVE_BALOO TRUE) +else() + find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS + KDELibs4Support # for KFileMetaDataWidget + ) endif() add_subdirectory(src) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1b04a642b..9ea45e34b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -3,8 +3,18 @@ configure_file(config-baloo.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-baloo.h) configure_file(config-dolphin.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-dolphin.h) -add_definitions(-DTRANSLATION_DOMAIN=\"dolphin\" -DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS) -remove_definitions(-DQT_NO_CAST_FROM_BYTEARRAY -DQT_NO_URL_CAST_FROM_STRING) +add_definitions( + -DTRANSLATION_DOMAIN=\"dolphin\" + -DQT_USE_FAST_CONCATENATION + -DQT_USE_FAST_OPERATOR_PLUS +) +remove_definitions( + -DQT_NO_CAST_FROM_BYTEARRAY + -DQT_NO_URL_CAST_FROM_STRING + -DQT_NO_SIGNALS_SLOTS_KEYWORDS + -DQT_NO_CAST_FROM_ASCII + -DQT_NO_CAST_TO_ASCII +) if(X11_Xrender_FOUND) set(HAVE_XRENDER TRUE) @@ -132,7 +142,16 @@ add_library(dolphinprivate ${dolphinprivate_LIB_SRCS}) target_link_libraries( dolphinprivate PUBLIC dolphinvcs - KF5::KDELibs4Support + Qt5::Gui + KF5::I18n + KF5::IconThemes + KF5::KIOCore + KF5::KIOWidgets + KF5::KIOFileWidgets + KF5::Completion + KF5::TextEditor + KF5::WindowSystem + KF5::ConfigCore KF5::NewStuff ) @@ -143,6 +162,11 @@ if(HAVE_BALOO) KF5::Baloo KF5::BalooWidgets ) +else() + target_link_libraries( + dolphinprivate PUBLIC + KF5::KDELibs4Support # for KFileMetaDataWidget + ) endif() if(X11_Xrender_FOUND) @@ -168,7 +192,6 @@ add_library(dolphinpart MODULE ${dolphinpart_SRCS}) target_link_libraries(dolphinpart dolphinprivate - KF5::KDELibs4Support ) install(TARGETS dolphinpart DESTINATION ${PLUGIN_INSTALL_DIR}) @@ -261,16 +284,14 @@ target_include_directories(kdeinit_dolphin PRIVATE ${PHONON_INCLUDES}) target_link_libraries(kdeinit_dolphin dolphinprivate - KF5::NewStuff KF5::Parts KF5::KCMUtils KF5::Solid - KF5::KIOFileWidgets - Phonon::phonon4qt5 - KF5::KDELibs4Support - KF5::I18n KF5::CoreAddons KF5::DBusAddons + KF5::Bookmarks + KF5::Notifications + Phonon::phonon4qt5 ) if (KF5Activities_FOUND) @@ -338,10 +359,10 @@ add_library(kcm_dolphinnavigation MODULE ${kcm_dolphinnavigation_PART_SRCS}) add_library(kcm_dolphinservices MODULE ${kcm_dolphinservices_PART_SRCS}) add_library(kcm_dolphingeneral MODULE ${kcm_dolphingeneral_PART_SRCS}) -target_link_libraries(kcm_dolphinviewmodes KF5::KDELibs4Support dolphinprivate) -target_link_libraries(kcm_dolphinnavigation KF5::KDELibs4Support dolphinprivate) -target_link_libraries(kcm_dolphinservices KF5::KDELibs4Support dolphinprivate) -target_link_libraries(kcm_dolphingeneral KF5::KDELibs4Support dolphinprivate) +target_link_libraries(kcm_dolphinviewmodes dolphinprivate) +target_link_libraries(kcm_dolphinnavigation dolphinprivate) +target_link_libraries(kcm_dolphinservices dolphinprivate) +target_link_libraries(kcm_dolphingeneral dolphinprivate) install(TARGETS kcm_dolphinviewmodes DESTINATION ${PLUGIN_INSTALL_DIR} ) install(TARGETS kcm_dolphinnavigation DESTINATION ${PLUGIN_INSTALL_DIR} ) diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index 0ee6e5c2c..1eda03e3c 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -53,7 +53,6 @@ #include #include #include -#include #include #include #include @@ -687,7 +686,10 @@ void DolphinMainWindow::openTerminal() // If the given directory is not local, it can still be the URL of an // ioslave using UDS_LOCAL_PATH which to be converted first. - QUrl url = KIO::NetAccess::mostLocalUrl(m_activeViewContainer->url(), this); + KIO::StatJob* statJob = KIO::mostLocalUrl(m_activeViewContainer->url()); + KJobWidgets::setWindow(statJob, this); + statJob->exec(); + QUrl url = statJob->mostLocalUrl(); //If the URL is local after the above conversion, set the directory. if (url.isLocalFile()) { diff --git a/src/dolphinmainwindow.h b/src/dolphinmainwindow.h index e3188aee5..5066657ef 100644 --- a/src/dolphinmainwindow.h +++ b/src/dolphinmainwindow.h @@ -31,7 +31,7 @@ #include #include -#include +#include typedef KIO::FileUndoManager::CommandType CommandType; @@ -493,7 +493,7 @@ private: DolphinViewActionHandler* m_actionHandler; DolphinRemoteEncoding* m_remoteEncoding; - QWeakPointer m_settingsDialog; + QPointer m_settingsDialog; // Members for the toolbar menu that is shown when the menubar is hidden: QToolButton* m_controlButton; diff --git a/src/dolphinpart.cpp b/src/dolphinpart.cpp index 35f328be5..ea0ffd92c 100644 --- a/src/dolphinpart.cpp +++ b/src/dolphinpart.cpp @@ -30,7 +30,6 @@ #include #include #include -#include #include #include #include @@ -38,6 +37,7 @@ #include #include #include +#include #include "dolphinpart_ext.h" #include "dolphinnewfilemenu.h" @@ -541,7 +541,10 @@ void DolphinPart::slotOpenTerminal() // If the given directory is not local, it can still be the URL of an // ioslave using UDS_LOCAL_PATH which to be converted first. - u = KIO::NetAccess::mostLocalUrl(u, widget()); + KIO::StatJob* statJob = KIO::mostLocalUrl(u); + KJobWidgets::setWindow(statJob, widget()); + statJob->exec(); + u = statJob->mostLocalUrl(); //If the URL is local after the above conversion, set the directory. if (u.isLocalFile()) { diff --git a/src/kitemviews/kitemlistcontroller.cpp b/src/kitemviews/kitemlistcontroller.cpp index 6c32e4b37..a9ebf97af 100644 --- a/src/kitemviews/kitemlistcontroller.cpp +++ b/src/kitemviews/kitemlistcontroller.cpp @@ -917,7 +917,8 @@ bool KItemListController::dropEvent(QGraphicsSceneDragDropEvent* event, const QT emit itemDropEvent(m_view->itemAt(pos), event); } - QAccessible::updateAccessibility(view(), 0, QAccessible::DragDropEnd); + QAccessibleEvent accessibilityEvent(view(), QAccessible::DragDropEnd); + QAccessible::updateAccessibility(&accessibilityEvent); return true; } @@ -1171,7 +1172,9 @@ void KItemListController::startDragging() drag->setHotSpot(hotSpot); drag->exec(Qt::MoveAction | Qt::CopyAction | Qt::LinkAction, Qt::CopyAction); - QAccessible::updateAccessibility(view(), 0, QAccessible::DragDropStart); + + QAccessibleEvent accessibilityEvent(view(), QAccessible::DragDropStart); + QAccessible::updateAccessibility(&accessibilityEvent); } KItemListWidget* KItemListController::hoveredWidget() const diff --git a/src/panels/folders/folderspanel.cpp b/src/panels/folders/folderspanel.cpp index e99c673bc..13df9019b 100644 --- a/src/panels/folders/folderspanel.cpp +++ b/src/panels/folders/folderspanel.cpp @@ -208,7 +208,7 @@ void FoldersPanel::slotItemContextMenuRequested(int index, const QPointF& pos) const KFileItem fileItem = m_model->fileItem(index); - QWeakPointer contextMenu = new TreeViewContextMenu(this, fileItem); + QPointer contextMenu = new TreeViewContextMenu(this, fileItem); contextMenu.data()->open(); if (contextMenu.data()) { delete contextMenu.data(); @@ -219,7 +219,7 @@ void FoldersPanel::slotViewContextMenuRequested(const QPointF& pos) { Q_UNUSED(pos); - QWeakPointer contextMenu = new TreeViewContextMenu(this, KFileItem()); + QPointer contextMenu = new TreeViewContextMenu(this, KFileItem()); contextMenu.data()->open(); if (contextMenu.data()) { delete contextMenu.data(); diff --git a/src/panels/folders/treeviewcontextmenu.cpp b/src/panels/folders/treeviewcontextmenu.cpp index bbdf783cd..e45fcd67e 100644 --- a/src/panels/folders/treeviewcontextmenu.cpp +++ b/src/panels/folders/treeviewcontextmenu.cpp @@ -42,6 +42,7 @@ #include #include #include +#include TreeViewContextMenu::TreeViewContextMenu(FoldersPanel* parent, const KFileItem& fileInfo) : @@ -148,7 +149,7 @@ void TreeViewContextMenu::open() } } - QWeakPointer popupPtr = popup; + QPointer popupPtr = popup; popup->exec(QCursor::pos()); if (popupPtr.data()) { popupPtr.data()->deleteLater(); diff --git a/src/panels/places/placesitemeditdialog.cpp b/src/panels/places/placesitemeditdialog.cpp index d5ca4bf4f..d035b0403 100644 --- a/src/panels/places/placesitemeditdialog.cpp +++ b/src/panels/places/placesitemeditdialog.cpp @@ -30,7 +30,6 @@ #include #include #include -#include #include #include #include diff --git a/src/panels/places/placesitemmodel.cpp b/src/panels/places/placesitemmodel.cpp index 354d4a43e..bc7c2b7d3 100644 --- a/src/panels/places/placesitemmodel.cpp +++ b/src/panels/places/placesitemmodel.cpp @@ -26,13 +26,11 @@ #include "dolphin_generalsettings.h" #include -#include #include #include "dolphindebug.h" #include #include #include -#include #include #include #include diff --git a/src/search/dolphinsearchbox.cpp b/src/search/dolphinsearchbox.cpp index d4ebba8c0..524c4462f 100644 --- a/src/search/dolphinsearchbox.cpp +++ b/src/search/dolphinsearchbox.cpp @@ -37,6 +37,7 @@ #include #include #include +#include #include #ifdef HAVE_BALOO @@ -130,9 +131,11 @@ QUrl DolphinSearchBox::urlForSearching() const url = balooUrlForSearching(); } else { url.setScheme("filenamesearch"); - url.addQueryItem("search", m_searchInput->text()); + + QUrlQuery query; + query.addQueryItem("search", m_searchInput->text()); if (m_contentButton->isChecked()) { - url.addQueryItem("checkContent", "yes"); + query.addQueryItem("checkContent", "yes"); } QString encodedUrl; @@ -144,7 +147,9 @@ QUrl DolphinSearchBox::urlForSearching() const } else { encodedUrl = m_searchPath.url(); } - url.addQueryItem("url", encodedUrl); + query.addQueryItem("url", encodedUrl); + + url.setQuery(query); } return url; @@ -155,9 +160,10 @@ void DolphinSearchBox::fromSearchUrl(const QUrl& url) if (url.scheme() == "baloosearch") { fromBalooSearchUrl(url); } else if (url.scheme() == "filenamesearch") { - setText(url.queryItemValue("search")); - setSearchPath(QUrl::fromUserInput(url.queryItemValue("url"), QString(), QUrl::AssumeLocalFile)); - m_contentButton->setChecked(url.queryItemValue("checkContent") == "yes"); + const QUrlQuery query(url); + setText(query.queryItemValue("search")); + setSearchPath(QUrl::fromUserInput(query.queryItemValue("url"), QString(), QUrl::AssumeLocalFile)); + m_contentButton->setChecked(query.queryItemValue("checkContent") == "yes"); } else { setText(QString()); setSearchPath(url); diff --git a/src/settings/startup/startupsettingspage.cpp b/src/settings/startup/startupsettingspage.cpp index baba7f8a1..21b213cd5 100644 --- a/src/settings/startup/startupsettingspage.cpp +++ b/src/settings/startup/startupsettingspage.cpp @@ -24,7 +24,6 @@ #include "dolphin_generalsettings.h" -#include #include #include #include @@ -36,6 +35,7 @@ #include #include #include +#include #include "views/dolphinview.h" @@ -165,7 +165,7 @@ void StartupSettingsPage::slotSettingsChanged() void StartupSettingsPage::selectHomeUrl() { const QString homeUrl = m_homeUrl->text(); - QUrl url = KFileDialog::getExistingDirectoryUrl(QUrl::fromLocalFile(homeUrl), this); + QUrl url = QFileDialog::getExistingDirectoryUrl(this, QString(), QUrl::fromLocalFile(homeUrl)); if (!url.isEmpty()) { m_homeUrl->setText(url.toDisplayString(QUrl::PreferLocalFile)); slotSettingsChanged(); diff --git a/src/settings/viewmodes/dolphinfontrequester.cpp b/src/settings/viewmodes/dolphinfontrequester.cpp index 4d8b4813c..b9c5d97cf 100644 --- a/src/settings/viewmodes/dolphinfontrequester.cpp +++ b/src/settings/viewmodes/dolphinfontrequester.cpp @@ -19,13 +19,13 @@ #include "dolphinfontrequester.h" -#include #include #include #include #include #include +#include DolphinFontRequester::DolphinFontRequester(QWidget* parent) : QWidget(parent), @@ -86,11 +86,9 @@ QFont DolphinFontRequester::customFont() const void DolphinFontRequester::openFontDialog() { - QFont font = m_customFont; - const int result = KFontDialog::getFont(font, - KFontChooser::NoDisplayFlags, - this); - if (result == KFontDialog::Accepted) { + bool ok = false; + const QFont font = QFontDialog::getFont(&ok, this); + if (ok) { m_customFont = font; m_modeCombo->setFont(m_customFont); emit changed(); diff --git a/src/settings/viewpropertiesdialog.cpp b/src/settings/viewpropertiesdialog.cpp index aa7e4b4a0..be7fe0d86 100644 --- a/src/settings/viewpropertiesdialog.cpp +++ b/src/settings/viewpropertiesdialog.cpp @@ -30,7 +30,6 @@ #include #include -#include #include #include #include diff --git a/src/tests/kfileitemlistviewtest.cpp b/src/tests/kfileitemlistviewtest.cpp index 5c40abba3..cac4f7a58 100644 --- a/src/tests/kfileitemlistviewtest.cpp +++ b/src/tests/kfileitemlistviewtest.cpp @@ -56,7 +56,7 @@ void KFileItemListViewTest::init() m_graphicsView = new QGraphicsView(); m_graphicsView->show(); - QTest::qWaitForWindowShown(m_graphicsView); + QTest::qWaitForWindowExposed(m_graphicsView); } void KFileItemListViewTest::cleanup() diff --git a/src/tests/kfileitemmodelbenchmark.cpp b/src/tests/kfileitemmodelbenchmark.cpp index c970a7198..b73485efb 100644 --- a/src/tests/kfileitemmodelbenchmark.cpp +++ b/src/tests/kfileitemmodelbenchmark.cpp @@ -29,18 +29,20 @@ #include "testdir.h" -void myMessageOutput(QtMsgType type, const char* msg) +void myMessageOutput(QtMsgType type, const QMessageLogContext& context, const QString& msg) { + Q_UNUSED(context); + switch (type) { case QtDebugMsg: break; case QtWarningMsg: break; case QtCriticalMsg: - fprintf(stderr, "Critical: %s\n", msg); + fprintf(stderr, "Critical: %s\n", msg.toLocal8Bit().data()); break; case QtFatalMsg: - fprintf(stderr, "Fatal: %s\n", msg); + fprintf(stderr, "Fatal: %s\n", msg.toLocal8Bit().data()); abort(); default: break; @@ -317,7 +319,7 @@ void KFileItemModelBenchmark::insertManyChildItems() KFileItemList KFileItemModelBenchmark::createFileItemList(const QStringList& fileNames, const QString& prefix) { // Suppress 'file does not exist anymore' messages from KFileItemPrivate::init(). - qInstallMsgHandler(myMessageOutput); + qInstallMessageHandler(myMessageOutput); KFileItemList result; foreach (const QString& name, fileNames) { diff --git a/src/tests/kfileitemmodeltest.cpp b/src/tests/kfileitemmodeltest.cpp index cf50db02a..eba32e1e1 100644 --- a/src/tests/kfileitemmodeltest.cpp +++ b/src/tests/kfileitemmodeltest.cpp @@ -29,18 +29,20 @@ #include "kitemviews/private/kfileitemmodeldirlister.h" #include "testdir.h" -void myMessageOutput(QtMsgType type, const char* msg) +void myMessageOutput(QtMsgType type, const QMessageLogContext& context, const QString& msg) { + Q_UNUSED(context); + switch (type) { case QtDebugMsg: break; case QtWarningMsg: break; case QtCriticalMsg: - fprintf(stderr, "Critical: %s\n", msg); + fprintf(stderr, "Critical: %s\n", msg.toLocal8Bit().data()); break; case QtFatalMsg: - fprintf(stderr, "Fatal: %s\n", msg); + fprintf(stderr, "Fatal: %s\n", msg.toLocal8Bit().data()); abort(); default: break; @@ -107,7 +109,7 @@ void KFileItemModelTest::init() { // The item-model tests result in a huge number of debugging // output from kdelibs. Only show critical and fatal messages. - qInstallMsgHandler(myMessageOutput); + qInstallMessageHandler(myMessageOutput); qRegisterMetaType("KItemRange"); qRegisterMetaType("KItemRangeList"); diff --git a/src/tests/kitemlistcontrollertest.cpp b/src/tests/kitemlistcontrollertest.cpp index dafb9f854..e34731fa4 100644 --- a/src/tests/kitemlistcontrollertest.cpp +++ b/src/tests/kitemlistcontrollertest.cpp @@ -142,7 +142,7 @@ void KItemListControllerTest::initTestCase() QVERIFY(spyDirectoryLoadingCompleted.wait()); m_container->show(); - QTest::qWaitForWindowShown(m_container); + QTest::qWaitForWindowExposed(m_container); } void KItemListControllerTest::cleanupTestCase() @@ -460,7 +460,7 @@ void KItemListControllerTest::testKeyboardNavigation_data() selectionBehaviorNames[selectionBehavior] + ", " + groupingEnabledNames[groupingEnabled]; - const QByteArray testNameAscii = testName.toAscii(); + const QByteArray testNameAscii = testName.toLatin1(); QTest::newRow(testNameAscii.data()) << layout diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp index 4129cc217..191cd6511 100644 --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -49,7 +49,6 @@ #include #include #include -#include #include #include #include diff --git a/src/views/renamedialog.cpp b/src/views/renamedialog.cpp index 6d009ba9a..be9e34c4a 100644 --- a/src/views/renamedialog.cpp +++ b/src/views/renamedialog.cpp @@ -23,7 +23,6 @@ #include #include #include -#include //TODO port to QCollator #include #include -- cgit v1.3.1