]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Port away from KDELibs4Support (we only use KDELibs4Support when baloo isn't present...
authorEmmanuel Pescosta <emmanuelpescosta099@gmail.com>
Thu, 26 Feb 2015 16:40:06 +0000 (17:40 +0100)
committerEmmanuel Pescosta <emmanuelpescosta099@gmail.com>
Thu, 26 Feb 2015 17:10:42 +0000 (18:10 +0100)
Reviewed-By: Vishesh Handa
20 files changed:
CMakeLists.txt
src/CMakeLists.txt
src/dolphinmainwindow.cpp
src/dolphinmainwindow.h
src/dolphinpart.cpp
src/kitemviews/kitemlistcontroller.cpp
src/panels/folders/folderspanel.cpp
src/panels/folders/treeviewcontextmenu.cpp
src/panels/places/placesitemeditdialog.cpp
src/panels/places/placesitemmodel.cpp
src/search/dolphinsearchbox.cpp
src/settings/startup/startupsettingspage.cpp
src/settings/viewmodes/dolphinfontrequester.cpp
src/settings/viewpropertiesdialog.cpp
src/tests/kfileitemlistviewtest.cpp
src/tests/kfileitemmodelbenchmark.cpp
src/tests/kfileitemmodeltest.cpp
src/tests/kitemlistcontrollertest.cpp
src/views/dolphinview.cpp
src/views/renamedialog.cpp

index f31def98e19f10c05da56a54a4ff28cd1b250950..9c2b109af00295a7063e9ec1f79da22a1774de12 100644 (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)
index 1b04a642b121b0c12b17b503eb08b939a18cbc80..9ea45e34b62cec4679424c06b4967cbfd4d3546a 100644 (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} )
index 0ee6e5c2cc376f64f17aaefce6047091fbf444be..1eda03e3c74a120fee35aee53b56e453bc917ded 100644 (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()) {
index e3188aee5625c17c0bf7d1d47a98dd10bd434c81..5066657ef8865137c9483c5c5b8733c9bf63b7cf 100644 (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;
index 35f328be55453afe926e97457359c1c18bef97c9..ea0ffd92c65a2918359a9ea15dc05964c09844c8 100644 (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()) {
index 6c32e4b37fbbd438de798e89d2593ccc57a808b7..a9ebf97af9a5e44336491ebd3b340ff754544d4f 100644 (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
index e99c673bc14490e673b733032ec307c40555110b..13df9019bf010729b8e60d850c8d51025976de66 100644 (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();
index bbdf783cd1bc4c6a1597c8e1e084ffffaea90441..e45fcd67e09692fe668ce00df40b477ddbf3101c 100644 (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();
index d5ca4bf4fd97fd5238a8e8f25fc0a9710c1dcd76..d035b0403f856b597b88dc96e775380b45f40945 100644 (file)
@@ -30,7 +30,6 @@
 #include <KLocalizedString>
 #include <QMimeDatabase>
 #include <KUrlRequester>
-#include <KComponentData>
 #include <QCheckBox>
 #include <QEvent>
 #include <QFormLayout>
index 354d4a43e90448c5d2c52c8d187657bf1b4564f5..bc7c2b7d3062215133fb5f594abed44dd3804a11 100644 (file)
 #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>
index d4ebba8c020f34f9392dc3c55961fb1e813ec583..524c4462f5440bf5ccc9f3731ad8d0aa2cc2d4ce 100644 (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);
index baba7f8a1370d35835e79b88c01949596e898036..21b213cd52e83fd3bb6dc2e57bab4d09875e68e1 100644 (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();
index 4d8b4813c488fe0d9a7638da747e06ef34b3d51c..b9c5d97cf8e899600faf32c221a37ef496f74494 100644 (file)
 
 #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();
index aa7e4b4a0b7ce7c9a836b38d79cd5ced31997bc6..be7fe0d8673cfe15d077f01fdc4b0d8620be349a 100644 (file)
@@ -30,7 +30,6 @@
 #include <config-baloo.h>
 
 #include <KLocalizedString>
-#include <KIO/NetAccess>
 #include <KMessageBox>
 #include <QUrl>
 #include <KComboBox>
index 5c40abba364e5857a4cf52aac79ca2680a66df4b..cac4f7a587bf520901fe58eb124b664013eeb24a 100644 (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()
index c970a7198c422db41c558a88a5d573bd70172b28..b73485efbfa67f3cc8bc104af55833b7ebcd3965 100644 (file)
 
 #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) {
index cf50db02a4bf2a3e9691e064b776b683679d6a2a..eba32e1e1caa341e1db26399b4027a86614309fc 100644 (file)
 #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");
index dafb9f854a744b2652362c834cccdf7c342eccd3..e34731fa4b59c1f058bc8ec6bd3255fc4b142f07 100644 (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
index 4129cc2174a82322cc585f820a07b05ead100c4b..191cd65119f46ecbd4ae1116ba8eb376a742fbd7 100644 (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>
index 6d009ba9a6f05d9524a4642351c37ebe08018e29..be9e34c4a138ce2d8db31008f949b019df981bfb 100644 (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>