1
0
mirror of https://invent.kde.org/system/dolphin synced 2024-07-02 16:31:23 +00:00

Port away from KDELibs4Support (we only use KDELibs4Support when baloo isn't present, because KFileMetaDataWidget is in KDELibs4Support)

Reviewed-By: Vishesh Handa
This commit is contained in:
Emmanuel Pescosta 2015-02-26 17:40:06 +01:00
parent 41424d0109
commit 832e157ecd
20 changed files with 96 additions and 56 deletions

View File

@ -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)

View File

@ -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} )

View File

@ -53,7 +53,6 @@
#include <KJobWidgets>
#include <QLineEdit>
#include <KToolBar>
#include <KIO/NetAccess>
#include <KIO/JobUiDelegate>
#include <KLocalizedString>
#include <KProtocolManager>
@ -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()) {

View File

@ -31,7 +31,7 @@
#include <QUrl>
#include <QList>
#include <QWeakPointer>
#include <QPointer>
typedef KIO::FileUndoManager::CommandType CommandType;
@ -493,7 +493,7 @@ private:
DolphinViewActionHandler* m_actionHandler;
DolphinRemoteEncoding* m_remoteEncoding;
QWeakPointer<DolphinSettingsDialog> m_settingsDialog;
QPointer<DolphinSettingsDialog> m_settingsDialog;
// Members for the toolbar menu that is shown when the menubar is hidden:
QToolButton* m_controlButton;

View File

@ -30,7 +30,6 @@
#include <KMessageBox>
#include <KPluginFactory>
#include <KRun>
#include <KIO/NetAccess>
#include <KToolInvocation>
#include <kauthorized.h>
#include <QMenu>
@ -38,6 +37,7 @@
#include <KSharedConfig>
#include <KConfigGroup>
#include <KMimeTypeEditor>
#include <KJobWidgets>
#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()) {

View File

@ -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

View File

@ -208,7 +208,7 @@ void FoldersPanel::slotItemContextMenuRequested(int index, const QPointF& pos)
const KFileItem fileItem = m_model->fileItem(index);
QWeakPointer<TreeViewContextMenu> contextMenu = new TreeViewContextMenu(this, fileItem);
QPointer<TreeViewContextMenu> 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<TreeViewContextMenu> contextMenu = new TreeViewContextMenu(this, KFileItem());
QPointer<TreeViewContextMenu> contextMenu = new TreeViewContextMenu(this, KFileItem());
contextMenu.data()->open();
if (contextMenu.data()) {
delete contextMenu.data();

View File

@ -42,6 +42,7 @@
#include <QApplication>
#include <QClipboard>
#include <QMimeData>
#include <QPointer>
TreeViewContextMenu::TreeViewContextMenu(FoldersPanel* parent,
const KFileItem& fileInfo) :
@ -148,7 +149,7 @@ void TreeViewContextMenu::open()
}
}
QWeakPointer<QMenu> popupPtr = popup;
QPointer<QMenu> popupPtr = popup;
popup->exec(QCursor::pos());
if (popupPtr.data()) {
popupPtr.data()->deleteLater();

View File

@ -30,7 +30,6 @@
#include <KLocalizedString>
#include <QMimeDatabase>
#include <KUrlRequester>
#include <KComponentData>
#include <QCheckBox>
#include <QEvent>
#include <QFormLayout>

View File

@ -26,13 +26,11 @@
#include "dolphin_generalsettings.h"
#include <KBookmark>
#include <KBookmarkGroup>
#include <KBookmarkManager>
#include "dolphindebug.h"
#include <QIcon>
#include <KProtocolInfo>
#include <KLocalizedString>
#include <KComponentData>
#include <QStandardPaths>
#include <KUser>
#include <KAboutData>

View File

@ -37,6 +37,7 @@
#include <QTimer>
#include <QToolButton>
#include <QVBoxLayout>
#include <QUrlQuery>
#include <config-baloo.h>
#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);

View File

@ -24,7 +24,6 @@
#include "dolphin_generalsettings.h"
#include <KFileDialog>
#include <KLocalizedString>
#include <QLineEdit>
#include <KMessageBox>
@ -36,6 +35,7 @@
#include <QPushButton>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QFileDialog>
#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();

View File

@ -19,13 +19,13 @@
#include "dolphinfontrequester.h"
#include <KFontDialog>
#include <KLocalizedString>
#include <KComboBox>
#include <QHBoxLayout>
#include <QPushButton>
#include <QFontDatabase>
#include <QFontDialog>
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();

View File

@ -30,7 +30,6 @@
#include <config-baloo.h>
#include <KLocalizedString>
#include <KIO/NetAccess>
#include <KMessageBox>
#include <QUrl>
#include <KComboBox>

View File

@ -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()

View File

@ -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) {

View File

@ -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>("KItemRange");
qRegisterMetaType<KItemRangeList>("KItemRangeList");

View File

@ -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

View File

@ -49,7 +49,6 @@
#include <KIO/CopyJob>
#include <KIO/DeleteJob>
#include <KIO/JobUiDelegate>
#include <KIO/NetAccess>
#include <KIO/PreviewJob>
#include <KIO/DropJob>
#include <KIO/PasteJob>

View File

@ -23,7 +23,6 @@
#include <KJobWidgets>
#include <KIO/CopyJob>
#include <KIO/FileUndoManager>
#include <kstringhandler_deprecated.h> //TODO port to QCollator
#include <KJobUiDelegate>
#include <QHBoxLayout>